Saturday, July 16, 2022

The long-range magnetic latch: simulation oddities.

 While doing additional simulations I got really strange results if the magnet was more than about 1 inch long.  The initial force between the magnet and iron pole piece came out as a negative number!  It didn't make any sense.  Then I started thinking about the simulation "universe".  Part of the initialization needed for the simulation is to define the boundary of the problem, basically how large the space around the magnet and pole pice is.  I'd been specifying a relatively small distance that defined this, because increasing it also causes the simulation time to increase.  Well, it turns out that was a bad idea for some cases.  When I increased the size of my simulation universe, suddenly the force numbers all made sense again -- they all were positive, no mysterious repelling force was present.

Even simulations with shorter magnets that did not exhibit negative force came out slightly different when the boundary distance was increased.

Moral of the story:  even though it can cause simulations to take longer than you like, it's important to make the problem boundary large enough.  Start with a smaller size, then increase it to see what happens to the simulation results.  Look at the results you get with a critical eye to see if they make sense or not.

No comments:

Post a Comment