Page 1 of 1

3D Magnetization for hundreds of magnets

Posted: 27 Nov 2017, 21:37
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
 

Re: 3D Magnetization for hundreds of magnets

Posted: 29 Nov 2017, 17:32
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.

Re: 3D Magnetization for hundreds of magnets

Posted: 03 Dec 2017, 20:25
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

Re: 3D Magnetization for hundreds of magnets

Posted: 05 Dec 2017, 00:52
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

Re: 3D Magnetization for hundreds of magnets

Posted: 06 Dec 2017, 00:23
by magman
That's pretty cool Peter! Thanks, I will check it out.

Cheers,
Eric