# Get force field from given magnetic moment and magnetic inductance field numerically

Abstract

Some time ago, someone gave me the next solution:

$$U=-\int \vec{m}\small{(x)}\times \vec{B}(x)dV$$ $$\vec{F}=-\nabla U$$

In other stack site I’ve asked, how to solve it numerically, and one user pointed that formulas are wrong, because $$U$$ is a number, not a field, and, hence, gradient operation can’t be applied to it.

I surely know that force is a negative gradient of potential energy, so the second formula is true.

Also, magnetic moment times magnetic inductance gives joules, i.e. potential energy. If I just multiply $$\vec{m}$$ at some point by $$\vec{B}$$ at the same point, I will have the potential energy value $$U$$ at that point. What is the purpose of the volume integral, then in the formula above?

Question

If I have magnetic moment and magnetic inductance values at every point of space, how can I find a force at every point of space?

My try

Okay, force is gradient of potential energy with minus sign, it’s for sure.

$$\vec{F}=-\nabla U$$

Magnetic moment times magnetic inductance gives something in joules units, it is energy, for sure. Relation between Force, i.e. Newtons and Energy, i.e. Joules is

$$N=\dfrac{J}{m}$$

Newtons equals Joules per meter. Nabla operator gives also “meters” in denominator:

$$\nabla=\dfrac{d\phi}{dx}+ \dfrac{d\phi}{dy}+ \dfrac{d\phi}{dz}$$

As I pointed in the question, I mentioned above, I will find force not at every point of some volume, because it is impossible, but at points with some step. For example for volume 1m*1m*1m I will find values with step, say, 100mm, i.e. 10 points in a row, and $$10^3$$ in total.

I will have known magnetic moment and magnetic inductance value for each point.

What if I will find energy at a point as just

$$U(x_0,y_0,z_0)= |\vec{m}\small{(x_0,y_0,z_0)}|* |\vec{B}(x_0,y_0,z_0)| * cos\theta$$

And then F as

$$\vec{F}(x_0,y_0,z_0)=\dfrac{U(x_0+k,y_0,z_0)-U(x_0,y_0,z_0)}{k}\vec{i}+ \dfrac{U(x_0,y_0+k,z_0)-U(x_0,y_0,z_0)}{k}\vec{j}+ \dfrac{U(x_0,y_0,z_0+k)-U(x_0,y_0,z_0)}{k}\vec{k}$$

Where k is step, i.e. 0.1 m. But it will not give a vector value...

• Your first equation doesn’t make sense because the vector product of two vector fields is a vector field, and integrating this field over all space gives a vector. May 23, 2020 at 16:19
• @G.Smith product gives a vector or a vector field? May 23, 2020 at 16:24
• The vector product of two vectors is a vector, so the vector product of two vector fields is a vector field. You take the product at every point in space. May 23, 2020 at 16:28

The force is

$$\vec F=\vec\nabla(\vec m \cdot \vec B)$$

because the potential energy of a magnetic dipole in a magnetic field is

$$U = - \vec m \cdot \vec B.$$

• I added to my answer something similar to what You did write. But the problem is that I do not have analytical functions, I have the exact values. I think I need to use a partial derivative at a point, or something like this instead of nabla operator, that is used for fields. Did I write it correctly (right in the bottom of my question)? May 23, 2020 at 16:48
• No. What you wrote doesn’t make sense. In your next-to-the-last equation, the left side is a scalar field and the right side is a vector field. In your last equation, the left side is a vector field and the right side is a scalar field. May 23, 2020 at 16:56
• The previous equation for $\nabla$ is also wrong. May 23, 2020 at 16:57
• How about now?? May 23, 2020 at 17:01
• The final equation is now OK as an approximation for small $k$. May 23, 2020 at 17:12