3D Magnetization for hundreds of magnets

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

3D Magnetization for hundreds of magnets

Post by magman »

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: 186
Joined: 23 Aug 2009, 23:59

Re: 3D Magnetization for hundreds of magnets

Post by Takala »

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[0], tx[1], tx[2])"
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

Post by magman »

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
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: 3D Magnetization for hundreds of magnets

Post by raback »

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
(74.4 KiB) Not downloaded yet
magman
Posts: 3
Joined: 27 Nov 2017, 19:47
Antispam: Yes

Re: 3D Magnetization for hundreds of magnets

Post by magman »

That's pretty cool Peter! Thanks, I will check it out.

Cheers,
Eric
Post Reply