## 3D Magnetization for hundreds of magnets

Numerical methods and mathematical models of Elmer
magman
Posts: 3
Joined: 27 Nov 2017, 19:47
Antispam: Yes

### 3D Magnetization for hundreds of magnets

First, thanks for such an awesome set of software tools!

I have a model with hundreds of magnets (all the same exact shape and size) that are placed around a sphere, so the magnetization is different for each magnet. I'll be using the MagenetoDynamics solver so can someone suggest a way to setup magnetization settings for the body force in the SIF file? The best I can come up with is to calculate the normal vector of each magnet from the model and dump those vectors to a file (vectors.dat). Then use vectors.dat as input to a python program which creates a Body Force section for each magnet (using one vector from vectors.dat), and it's corresponding Body section associating the correct body with the appropriate body force. Is there an easier way to do this?

Thanks for any help!

Code: Select all

``````pseudo code:
using Model
for each Magnet
calculate normal vector (to surface of sphere)
save body # and vector result to vectors.dat

using vectors.dat
for each line in file
write "Body Force" section where Magnetization 1 = x of vector, Magnetization 2 = y of vector, Magnetization 3 = z of vector
write "Body" section and assign BodyForce from previous step to this body
``````

Takala
Posts: 183
Joined: 23 Aug 2009, 23:59

### Re: 3D Magnetization for hundreds of magnets

Hello,

you can do variable magnetization as well with MATC:

Code: Select all

``````Body Force 1
Magnetization 1 = Variable Coordinate 1, Coordinate 2, Coordinate 3
Real MATC "f(tx, tx, tx)"
End
``````
where f(x,y,z) is the function (you need to define that with MATC) that varies the magnetization and tx (i=1,2,3) are the coordinate 1, coordinate 2 and coordinate 3 variables.

or with User Defined Function (you need to write it in fortran and compile it with elmerf90 but it is way quicker than MATC)

Code: Select all

``````Body Force 1
Magnetization 1 = Variable Coordinate 1, Coordinate 2, Coordinate 3
Real Procedure "MyLib" "MyFunction"
End
``````
and then you write user function MyFunction in MyLib.F90 file.

You probably need to study the docs for this to get the details correctly.

magman
Posts: 3
Joined: 27 Nov 2017, 19:47
Antispam: Yes

### Re: 3D Magnetization for hundreds of magnets

Thanks for the response! I will read the manuals in more depth and see if that's something I can pull off.

Cheers,
Eric

raback
Posts: 3670
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

### Re: 3D Magnetization for hundreds of magnets

Hi

The "CoilSolver" has nowadays some automatic detection of coils. If you're lucky it could set a potential for the coil that gives the desired current. Not exactly what you're looking for but maybe still related. See attached figure of a few random coils.

-Peter
Attachments
ManyCoils.jpg
many coils