Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

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.

Creating two Magnets with opposite Polarities

Please login with a confirmed email address before reporting spam

Dear All,

I want to create two magnets (Assume to blocks up and down with a distance from each other) that have opposite polarities so as a result they will repel each other. (see attached pic)

How can I do that?

Thank you.



13 Replies Last Post 2015年5月27日 GMT-4 00:49
Robert Koslover Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2014年6月23日 GMT-4 21:40
I've attached a basic model (uploaded without the solution to save memory) of what you described, as well as a picture showing the result after execution.
I've attached a basic model (uploaded without the solution to save memory) of what you described, as well as a picture showing the result after execution.


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2014年6月24日 GMT-4 11:26
Dear Robert,

Thank you very much, but your file doesn't open and it gives a message of "comsol muliphysics model file is damaged or not valid".

Would you please fix and send me again.

I appreciate it.
Dear Robert, Thank you very much, but your file doesn't open and it gives a message of "comsol muliphysics model file is damaged or not valid". Would you please fix and send me again. I appreciate it.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2014年6月25日 GMT-4 15:35
Dear Robert,

Your file doesn't open and it gives a message of "comsol muliphysics model file is damaged or not valid".

Would you please fix and send it again.

Thank you.
Dear Robert, Your file doesn't open and it gives a message of "comsol muliphysics model file is damaged or not valid". Would you please fix and send it again. Thank you.

Robert Koslover Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2014年6月25日 GMT-4 19:55
It works fine for me. Are you using the latest-updated version of Comsol Multiphysics 4.4 with the AC/DC module?
It works fine for me. Are you using the latest-updated version of Comsol Multiphysics 4.4 with the AC/DC module?


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2014年6月27日 GMT-4 11:15
Yes I am using Comsol 4.4 with all modules including AC/DC, but I can't open your file.

I have attached my sample, would you please fix and send it back, maybe in that case I would be able to open the file.

Thank you.
Yes I am using Comsol 4.4 with all modules including AC/DC, but I can't open your file. I have attached my sample, would you please fix and send it back, maybe in that case I would be able to open the file. Thank you.


Robert Koslover Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2014年6月27日 GMT-4 18:55
I may be mis-reading your file, but it appears that:
(1) you never defined your materials, and
(2) you did not include any volume of space around your magnets.
Both are essential before you can run your model. Every field region in the model requires material properties. And you must include plenty of space around your magnets, so that the fields can be computed within that space.
I may be mis-reading your file, but it appears that: (1) you never defined your materials, and (2) you did not include any volume of space around your magnets. Both are essential before you can run your model. Every field region in the model requires material properties. And you must include plenty of space around your magnets, so that the fields can be computed within that space.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2014年6月28日 GMT-4 01:11
Dear Robert,

I built this model without any data so you can build yours, because I can't open your file maybe I will be able to open this file.

I need to learn how can I define opposite polarities in the magnets.

Please insert all necessary data in that model as you did in yours. (The same way)

Thank you very much
Dear Robert, I built this model without any data so you can build yours, because I can't open your file maybe I will be able to open this file. I need to learn how can I define opposite polarities in the magnets. Please insert all necessary data in that model as you did in yours. (The same way) Thank you very much

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2014年7月1日 GMT-4 12:07
I have updated my file, would you please tell how and where should I define opposite polarities in the magnets?

Thank you.
I have updated my file, would you please tell how and where should I define opposite polarities in the magnets? Thank you.


Robert Koslover Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2014年7月1日 GMT-4 21:40
In your file, in the Model Builder, under Magnetic Fields, No Currents, choose Magnetic Flux Conservation (which is already in your list) or create a new one of those if you prefer. Select the domain of just one of the magnets to go with this. In the Magnetic Flux Conservation dialog, go to "Constitutive relation:" Choose "Magnetization". Put a number in for the z-component of M and leave the others zero. Now do the above all over again for the domain representing the other magnet, but specify the opposite sign for the z-component of M. This will point the two different values of M in opposite directions along z.
In your file, in the Model Builder, under Magnetic Fields, No Currents, choose Magnetic Flux Conservation (which is already in your list) or create a new one of those if you prefer. Select the domain of just one of the magnets to go with this. In the Magnetic Flux Conservation dialog, go to "Constitutive relation:" Choose "Magnetization". Put a number in for the z-component of M and leave the others zero. Now do the above all over again for the domain representing the other magnet, but specify the opposite sign for the z-component of M. This will point the two different values of M in opposite directions along z.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2014年7月2日 GMT-4 20:47
Thank you very much Robert.
Thank you very much Robert.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2014年7月7日 GMT-4 14:08
I have attached two models. Magnets are on tip of the rods.
In the first model, I have defined the magnets and fixed the end of the rods ( Solid Mechanics).
And I want to see the two magnets attract or repel each other but it seems Comsol doesn't do the coupling automatically! coupling of Magetic and solid mechanics.

In the second one, I have put body forces to the magnets equal to the force that Comsol Estimates in Magnetic module.

Now my question, is there any way that comsol will automatically calculate the magnets repelling/attracting forces and put it in solid mechanics as BC?

Or the only way is that I have done in second model.

Thank you.
I have attached two models. Magnets are on tip of the rods. In the first model, I have defined the magnets and fixed the end of the rods ( Solid Mechanics). And I want to see the two magnets attract or repel each other but it seems Comsol doesn't do the coupling automatically! coupling of Magetic and solid mechanics. In the second one, I have put body forces to the magnets equal to the force that Comsol Estimates in Magnetic module. Now my question, is there any way that comsol will automatically calculate the magnets repelling/attracting forces and put it in solid mechanics as BC? Or the only way is that I have done in second model. Thank you.


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2014年7月10日 GMT-4 14:04
Dear Robert,

I have attached two models.
In the first one, I have defined the magnets and fixed the end of the rods ( Solid Mechanics).
And I want to see the two magnets attract or repel each other but it seems Comsol doesn't do the coupling automatically! coupling of Magetic and solid mechanics. Because the rods don't deform.

In the second one, I have put body forces to the magnets equal to the force that Comsol Estimates in Magnetic module. But this can't be correct since I am adding the forces direction manually, so it is not dependent to the polarity of magnets.

Is there any way to do this automatically? coupling solid mechanics with magnetic modules and see the deformation of rods due to polarity of magnets.

Thank you.
Dear Robert, I have attached two models. In the first one, I have defined the magnets and fixed the end of the rods ( Solid Mechanics). And I want to see the two magnets attract or repel each other but it seems Comsol doesn't do the coupling automatically! coupling of Magetic and solid mechanics. Because the rods don't deform. In the second one, I have put body forces to the magnets equal to the force that Comsol Estimates in Magnetic module. But this can't be correct since I am adding the forces direction manually, so it is not dependent to the polarity of magnets. Is there any way to do this automatically? coupling solid mechanics with magnetic modules and see the deformation of rods due to polarity of magnets. Thank you.


Please login with a confirmed email address before reporting spam

Posted: 9 years ago 2015年5月27日 GMT-4 00:49
Dear Edvin Golestanyan
have you gotten the answer because I stopped in this point also.
Thank you
Dear Edvin Golestanyan have you gotten the answer because I stopped in this point also. Thank you

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.