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 27.05.2015, 00:49 GMT-4
Robert Koslover Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 23.06.2014, 21:40 GMT-4
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 24.06.2014, 11:26 GMT-4
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 25.06.2014, 15:35 GMT-4
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 25.06.2014, 19:55 GMT-4
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 27.06.2014, 11:15 GMT-4
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 27.06.2014, 18:55 GMT-4
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 28.06.2014, 01:11 GMT-4
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 01.07.2014, 12:07 GMT-4
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 01.07.2014, 21:40 GMT-4
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 02.07.2014, 20:47 GMT-4
Thank you very much Robert.
Thank you very much Robert.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 07.07.2014, 14:08 GMT-4
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 10.07.2014, 14:04 GMT-4
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: 10 years ago 27.05.2015, 00:49 GMT-4
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.