cmt-dtu-energy / MagTense

MagTense - a micromagnetism and magnetostatic framework
http://www.MagTense.org
GNU General Public License v3.0
28 stars 12 forks source link

Examples of permanent magnets with 3D polarization #18

Closed zhucaoxiang closed 2 years ago

zhucaoxiang commented 3 years ago

Hi, I am trying to find a tool calculating the magnetic field from a permanent magnet (with or without constant mu). The magnet is cuboidal, but the magnetization direction is not necessarily normal to faces and is arbitrary in 3D space. Like a generic case of the one you show on the webpage. I am wondering if this can be realized the MagTense? If yes, do you have some examples? Thanks in advance!

image

rasmusbj commented 3 years ago

This is certainly possible in MagTense. The orientation can be arbitrary in space and the magnetization can be any direction. Do you use Matlab or Python? Then we can perhaps help set up an example.

zhucaoxiang commented 3 years ago

@rasmusbj Thanks for your answer. It would be great if you have some examples in python. By the way, is it possible to specify a non-linear B-H curve in the code?

spollok commented 2 years ago

@zhucaoxiang I have just updated one of the python examples to show how a rectangular prism can be defined arbitrarily in 3D space (optionally a rotation could be added as well): https://github.com/cmt-dtu-energy/MagTense/blob/33a8fa7c6939fec08ce38b490d6f72c73f07c8c3/python/examples/prisms_3D.py#L24-L73

Currently, we have three different magnet types implemented: hard, soft, soft with constant permeability. In the case of a soft magnet, a possibly non-linear M-H-curve can be specified. Sample curves can be found here: https://github.com/cmt-dtu-energy/MagTense/tree/master/python/util

zhucaoxiang commented 2 years ago

@spollok Thanks for your help! This is useful. I probably will come back with questions.

rasmusbj commented 2 years ago

The examples has been pushed on the main Git branch and thus I will close this issue for now. It can always be reopened :)

zhucaoxiang commented 2 years ago

@rasmusbj Hi, thanks for the example. I am able to do some interesting calculations. I am wondering

  1. How to read cutomized B-H data (any documentation in the format)?
  2. Is it possible to provide an external field?

Thank you in advance.

zhucaoxiang commented 2 years ago

@spollok Maybe I should assign you.

spollok commented 2 years ago

@zhucaoxiang No worries. I got notified of the questions :) To 1.) I will update the documentation on it today. To 2.) Currently, that is not possible in the magnetostatic part. I had a discussion on it with @rasmusbj already and it is planned to be implemented as it should be straightforward. However, we do not have it scheduled yet.

zhucaoxiang commented 2 years ago

@spollok Great, thank you!

spollok commented 2 years ago

@zhucaoxiang I have started the documentation on how to read in a customized M-H-curve: https://github.com/cmt-dtu-energy/MagTense/tree/master/python#read-in-cutomized-m-h-curve Please let me know if something remains unclear.

zhucaoxiang commented 2 years ago

@spollok Thanks for the documentation. I was wondering if I can simulate the nonlinear permeability of neodymium magnets using magnet_type=2 but reading an actual M-H curve from neodymium magnets.

spollok commented 2 years ago

@zhucaoxiang Unfortunately, this is currently not possible. The direction of the magnetization of magnet_type=2 will iteratively align with the H-field produced in its center point by all the magnets present in the simulation. Hence, one will loose the magnetic anisotropy of the hard magnet. But that could be a further feature to be implemented soon.