Simulating toy magnet balls ? (eg: Zen magnets)

In summary: If you make two lines that are the same distance from each other, they will attract each other. If you make two circles that are the same distance from each other, they will repel each other.
  • #1
vlad2048
5
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
  • #2
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
 
  • #3
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
 
  • #4
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)/[itex]r^{5}[/itex] - m/[itex]r^{3}[/itex]
Calculating the torque on a dipole is very easy too (=m^B)

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

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

4) Any ideas to improve the simulation ?
 
Last edited:
  • Like
Likes middlewareman
  • #5
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.
 
  • #6
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.
 
  • #7
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)
 

Related to Simulating toy magnet balls ? (eg: Zen magnets)

1. What are toy magnet balls and how do they work?

Toy magnet balls, also known as Zen magnets, are small spherical magnets that are used for building and creating various shapes and structures. They work by attracting and repelling each other due to their magnetic fields, allowing them to stick together and form different patterns and designs.

2. Are toy magnet balls safe for children to play with?

While toy magnet balls may seem like a fun and harmless toy, they can actually be dangerous if swallowed. If multiple magnets are ingested, they can attract each other within the digestive system and cause serious complications. Therefore, it is important for children to be supervised while playing with these magnets and for parents to make sure they are using larger, child-safe versions.

3. Can you simulate the behavior of toy magnet balls?

Yes, it is possible to simulate the behavior of toy magnet balls using computer software. This can be done by creating a virtual 3D model of the magnets and programming the interactions between them based on their magnetic fields. This allows for a safer and more convenient way to experiment with different arrangements and patterns.

4. What are the benefits of simulating toy magnet balls?

Simulating toy magnet balls can have several benefits, such as being able to visualize and test out different designs and structures before actually building them, saving time and resources. It also allows for a deeper understanding of the physics behind magnetism and how it affects the behavior of these toys.

5. How accurate are simulations of toy magnet balls compared to real-life interactions?

The accuracy of simulations of toy magnet balls can vary depending on the software and the complexity of the interactions being simulated. However, with advanced algorithms and modeling techniques, simulations can closely mimic real-life interactions and provide valuable insights into the behavior of these magnets.

Similar threads

  • Electromagnetism
Replies
2
Views
78
  • Electromagnetism
Replies
3
Views
1K
  • Electromagnetism
Replies
7
Views
404
Replies
8
Views
823
  • Electromagnetism
Replies
5
Views
425
  • Electromagnetism
Replies
7
Views
1K
Replies
1
Views
1K
Replies
4
Views
392
Replies
21
Views
2K
  • Electromagnetism
Replies
1
Views
723
Back
Top