Simulating toy magnet balls ? (eg: Zen magnets)

AI Thread Summary
The discussion focuses on simulating the interaction of toy magnetic balls, specifically how to calculate the forces between them as magnetic dipoles. Participants highlight the complexities of ferromagnetism and suggest starting with empirical models to measure forces at varying distances. One user shares progress on a prototype using the Farseer physics engine, noting challenges with stability and accuracy in simulating configurations. Questions arise about using magnetic equations for more realistic results and how to calculate forces and magnetic fields effectively. The conversation emphasizes experimentation and the potential for improvements in simulation accuracy and stability.
vlad2048
Messages
5
Reaction score
1
I'd like to simulate the interaction between these magnetic balls on my computer.
I suppose they are magnetic dipoles, how would I go about finding out the forces applying between 2 of them in a specific configuration ?

Do I need to find the magnetic field and then apply the Lorentz force equation ? How would I find the magnetic field ?

Thanks !
 
Physics news on Phys.org
vlad2048 said:
I'd like to simulate the interaction between these magnetic balls on my computer.
I suppose they are magnetic dipoles, how would I go about finding out the forces applying between 2 of them in a specific configuration ?

Do I need to find the magnetic field and then apply the Lorentz force equation ? How would I find the magnetic field ?

Thanks !

Ferromagnetism s notoriously difficult to analyze, because it's caused by extremely complex (quantum) behavior of the electrons in the metal.

Even very approximate equations would be nonlinear, because the magnetization of them changes based on the applied field.

Even measuring the magnetic field is notoriously difficult, for similar reasons - which is why when buying magnets, you generally don't get that type of information.

However, don't let that discourage you... If you're simulating this as a "toy" -- e.g. You're not going to be using the output for anything -- you could probably come up with a workable empirical model. You might start by measuring the forces between two magnets at varying distances using pendulums, springs, or even a scale, then plug those into Newton's 2nd law.

If you get anything working, be sure to share -- make it JavaScript so I can try it on my iPad ;).

Good luck,
Justin
 
Thanks.
Indeed, it's just a toy, I don't need to be accurate here.
Hopefully it shouldn't be too hard. I'll try to make a prototype in c# using farseer physics engine. And if it turns out ok, I'll make an app for my shiny new iPad 3 :)
I'll limit myself to 2 dimensions. I'm really curious to see if I can simulate the crystal like arrangements of the real toy. If it works well, I could easily imagine a bridge builder like clone using lots of little magnets :)
I'll keep you posted
 
Alright, I got a prototype working, it's pretty fun.
I wish I didn't have to work tomorrow, I would port it to the iPad straight away :)
https://www.youtube.com/watch?v=92mLz4GMUPE
Here this structure is not terribly stable which makes sense as the hexagon with a ball in the middle is not a planar structure with the real balls (you would need 2*pi balls around the central ball for it to be planar)
https://www.youtube.com/watch?v=glxTVMenEWU
Source code: https://rapidshare.com/files/434299666/MagnetProto.rar
Exe: https://rapidshare.com/files/3871493948/MagnetProtoExe.rar
space: create magnet
D: delete magnet
F: fix magnet's position/orientation

Basically, I model the magnets by an electric dipole that's about 2x as small as the sphere (parameter DipoleLength). It works, but it's not very good yet:
- I cannot do the basic triangle figure (it's not very stable already with real balls)
- Because of arithmetic error, some configurations never stop turning
- It's just too wiggly. If I increase the force, it tends to blow up though

I'm still not finished playing with the parameters yet. But still I have a few questions

1) I'd like to use the magnetic equations instead, do you think I'll get a more realistic result ?

So calculating the magnetic field is easy (yellow arrows in the video) B=3r(m.r)/r^{5} - m/r^{3}
Calculating the torque on a dipole is very easy too (=m^B)

2) But how do I calculate the force on a dipole =\nabla(m.B) ?
How do I calculate the gradient of m.B ?

3) Also, on the wikipedia, they define the magnetic field as B=\nabla^A with A=m^r/r^{3}.
How do they deduce the equation above B=3r(m.r)/r^{5} - m/r^{3} ?

4) Any ideas to improve the simulation ?
 
Last edited:
  • Like
Likes middlewareman
Rectification, I managed to make the triangle. Reducing the size of the dipole and increasing the magnetic force did the trick. I suppose the model gets more accurate when the dipole gets really small.
 
Unfortunately it doesn't translate to 3 dimensions.
I've done a little app for iPad using the bullet physics engine.
And for some reason it's not stable at all and I can't figure out why.

I'm pretty sure I got the equations right. I've played with all the parameters but the magnets spin out of control so much. You guys have any idea why ?

I should maybe rewrite it on my PC in a different framework. Maybe bullet is not appropriate for that.
 
Using diples is a nice approximation for large distances. But it underestimates the forces when the magnets are close to each other (especially when they touch each other). This is probably the reason why you can bend your lines and circles in ways the real magnets do not allow (without constant external forces).

Maybe you can improve it with additional terms which describe these contacts.
Multiple dipoles within the volume might be an interesting concept.

What happens in your simulation if you make two parallel lines of magnets with the same/opposite magnetic orientation? Do you get the correct result? (I assume that you have real magnets or at least know how they behave - otherwise, ask)
 

Similar threads

Replies
1
Views
620
Replies
2
Views
1K
Replies
3
Views
2K
Replies
7
Views
1K
Replies
5
Views
2K
Replies
42
Views
2K
Replies
7
Views
3K
Back
Top