This is a simulation of the movement of an electric motor whose coil has $N$ rectangular turns.
The angular acceleration $\alpha$ of the loop is calculated using Newton's second law for rotations:
$$
\tau = I_M \alpha,
$$
where $I_M$ is the moment of inertia of the set of turns.
The equations of motion are integrated using the fourth order Runge-Kutta method with time step $h$.
The force that causes the torque capable of moving the set of turns is
the magnetic force $F_B$, defined as
$$
\vec{F}_B = i \vec{L}_1 \times \vec{B},
$$
where $i$ is the electric current circulating in the turns and $L_1$ is the length of the part of the wire that is orthogonal
to the direction of the magnetic field $B$ generated by the magnets.
The dynamics of the electric motor of this application takes into account the effect of induced current
by Faraday's law, but not the self-induction effect of electric current due to
variation of the current in the coil. The magnetic field of magnets is considered uniform.
Read more: