I wrote simple physics mass-spring engine, and I want to add the magnetism. Each body consists of tiny connected spheres with some mass.

The only input values to calculate magnetic interactions I have is magnetic susceptibility $\chi$, and external magnetic field strength $\vec{H}$.

Earlier I found very similar question, where the force on a magnet can be found:

$$U=-\int \vec{m}(x) \times \vec{B}(x)dV\space\tiny{(1)}$$ $$\tiny{\vec{m}\space -\space magnetic\space moment,\space dV\space-\space general\space volume}$$ $$\vec{F}=-\nabla U \space\tiny{(2)}$$

I can express magnetic moment from susceptibility:

$$\vec {m} = \vec{M} V=\chi H_{ext}V\space \tiny{(3)}$$ $$\tiny{\vec{M}\space-\space magnetization, \space V\space-\space volume}$$

My questions:

  1. Should I just set the magnetic moment value same(if the external field is same) to each particle of the body, or one half of particles - one value, another - I don’t know, perhaps the same value but with minus?
  2. What to do with the second factor of the equation (1), considering I have only external magnetic strength, not induction at each point?

My try.

Obviously(yes?), the task is to find magnetic field, created by permanent magnet. We also know that magnet does create magnetic field only after magnetization by another magnet.

The most similar equation for finding magnetic field value is Bio-Savart-Laplas law, but it is for current loop. Which actually is permanent magnet - array of tiny electrical loops with two unpaired electrons(for iron). I actually seen in this site guy, trying to find magnetic field, created by the iron atom, in classical way, assuming that electron moves around hydrogen atom, but it is absolutely senseless, because nuclear also creates magnetic field, that cancels electron’s magnetic field, and at all, it as a hydrogen atom where there is only 1 electron. We are talking about iron, for instance.

What if to just replace $\vec{B}$ with $\vec{H}$ in formula (1)? And make magnetic moment same for same $\vec{H}$, i.e. not depending on position(I mean will there still be poles🤔)?


Answers are not coming, I can’t waste time, so the only approximation I can implement is down below.

In app loop I already have one force acting on each particle(bodies consist of tiny spheres in mass-spring systems) - gravity:

  for(int i=0; i < particles_count; i++)
  float f=9.8f * particle[i]->mass;

  particle[i]->force(f, Vector3(0, -1, 0));

Now I assume that external magnetic field, which is set by $\vec{H}$ field is already a force field. Then, the only thing I need to deal with is understand which formula should I use.

I think if I just make one half of particles be with one magnetic moment, and another with the opposite sign, then I will have interaction similar to magnetic.

The force on each particle with precalculated magnetic susceptibility sign(Note that it all is actually wrong, because units will not give Newtons in the end):


Or in code

 float magnetic_force=particle[i]->khi * h_field_const * h_field_const * particle[i]->volume;

 particle[i]->force(magnetic_force, h_field_direction_const);

This approximation, also doesn’t even consider interaction between local magnets( magnetic field, as you can see from code is constant, and set without setting any other magnet)

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.