Simulating toy magnet balls ? (eg: Zen magnets)

  • Context: Undergrad 
  • Thread starter Thread starter vlad2048
  • Start date Start date
  • Tags Tags
    Balls Magnet Magnets
Click For Summary

Discussion Overview

The discussion revolves around simulating the interactions between toy magnetic balls, specifically focusing on their behavior as magnetic dipoles. Participants explore various approaches to modeling the forces between the magnets, including the use of empirical methods and theoretical magnetic equations. The scope includes technical challenges, programming considerations, and the desire to replicate real-world behaviors in a simulation.

Discussion Character

  • Exploratory
  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant suggests using the Lorentz force equation to find the forces between two magnetic dipoles, questioning how to determine the magnetic field.
  • Another participant notes the complexity of ferromagnetism and suggests that an empirical model could be developed for a toy simulation, recommending measuring forces between magnets at varying distances.
  • A participant shares progress on a prototype simulation using the Farseer physics engine, expressing interest in simulating crystal-like arrangements of magnets.
  • Further details are provided about the prototype's limitations, including stability issues and the need for parameter adjustments.
  • Questions are raised about using magnetic equations for more realistic results, including how to calculate the force on a dipole and the gradient of the magnetic field.
  • Another participant mentions that using dipoles is a good approximation at large distances but may underestimate forces when magnets are in close proximity, suggesting the need for additional terms to account for contact interactions.
  • Concerns are expressed about the stability of a new app developed for the iPad using the Bullet physics engine, with a request for insights into potential issues.

Areas of Agreement / Disagreement

Participants express a range of views on the best methods for simulating magnetic interactions, with no consensus on a definitive approach. There is acknowledgment of the challenges in accurately modeling the behavior of magnets, particularly at close distances.

Contextual Notes

Participants highlight limitations in their models, including the dependence on the size of the dipole and the stability of configurations. There are unresolved mathematical steps regarding the calculation of forces and fields, as well as the appropriateness of different physics engines for the simulation.

Who May Find This Useful

This discussion may be of interest to those involved in physics simulations, game development, or anyone curious about the behavior of magnetic materials in a computational context.

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   Reactions: 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 ·
Replies
1
Views
1K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 6 ·
Replies
6
Views
1K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K