Maxwell stress tensor and Force Density

Hello,
I want to calculate the force density on a rotor in NGSolve. I achieved to calculate and display the Maxwell Stress Tensor (MST) by calculating the value of B magnetic field density (T), the location of results seem ok (i need to validate with Ansys). But I can’t have the Force Density, since I need to do the divergence of sigma (MST).

Here is my code :

  B=Grad(gfu)
  sigma = 1/(mu0 * mur) * (OuterProduct(B, B) - 0.5 * (B*B) * Id(2) )

What I need to achieve is to have a tool allowing me to do something like :

force= Div(sigma)

But Sigma is a coefficientfunction…

Thank you for your help !

1 Like

You compute with Div(sigma) like for the load vector, using integration by parts:

f = LinearForm( InnerProduct(sigma, Grad(v))*dx )

If you like you can solve with a mass-matrix to visualize the force density.
Or with a surface mass matrix.

Joachim