# Calculating Magnetic Flux in 3D

by OrenKatzen
Tags: density, flux, magnet
 PF Gold P: 1,167 Calculating Magnetic Flux in 3D The problem is quite difficult in general. If both pieces are magnetized hard ferrites - magnets (have permanent magnetization), here is what I would do: 0. find out the magnetization ##\mathbf M## of both pieces; in the simplest case, each magnet has uniform magnetization, so just there are just two vectors, one for each magnet; 1. divide both the magnet and the ferrite into small domains (cubes) ##i## with volume ##\Delta V_i##; 2. the magnetic moments ##\mathbf m_i## can be found as ##\mathbf m_i = \mathbf M(i) \Delta V_i##, where ##\mathbf M(i)## is the magnetization at i; 3. there is a formula for the force acting on the moment i due to the moment j: $$\mathbf F(i) = - \mathbf m_i \cdot \nabla \mathbf B_j(\mathbf x_i)$$ where ##\mathbf B_j(\mathbf x)## is the magnetic field due to the moment j: $$\mathbf B_j(\mathbf x) = \frac{\mu_0}{4\pi} \frac{3\mathbf n(\mathbf n\cdot \mathbf m_j)- \mathbf m_j}{|x-\mathbf r_j|^3}$$ and ##\mathbf n = \frac{\mathbf x-\mathbf r_j}{|x-\mathbf r_j|}## 4. total force = sum of the forces between all pairs (i,j), where i comes from the first magnet, j comes from the second magnet.