Lagrange multipliers and their physical meaning

Source: Test

Lagrange multiplier-y learning time

After the immensely-practical torque calculation series, let’s do something completely different: intricacies of numerical analysis. Yay!

Are you familiar with Lagrange multipliers? Besides their obvious use in optimization, they are also quite handy in finite element analysis. Like in optimization, their purpose in FEA is enforcing boundary conditions and other constraints. However, to get correct results, it’s kinda important that you don’t just blindly throw them into the mix.

Unfortunately, the mix often ends up looking like this.

Sliding interface

I first came across them in an electric motor simulation. They were used to enforce continuity between separate stator and rotor meshes, across a so-called sliding interface. The continuity was defined based on something called the polynomial interpolation method, but that’s not important right now. What IS important is that the continuity condition looked like something as simple as

\mathbf{I} \mathbf{a}_\mathrm{r} = \mathbf{P} \mathbf{a}_\mathrm{s}.

In other words, the potential on rotor-side of airgap was set to equal to stator-side.

In addition, the basic FEA equation of

\begin{bmatrix} \mathbf{S}_\mathrm{s} & \mathbf{0} \\ \mathbf{0} & \mathbf{S}_\mathrm{s} \end{bmatrix} \begin{bmatrix} \mathbf{a}_\mathrm{s} \\ \mathbf{a}_\mathrm{r} \end{bmatrix} = \begin{bmatrix} f_\mathrm{s} \\ f_\mathrm{r} \end{bmatrix}

should of course be satisfied.

Now, I was in a hurry to get things done, so I dug only a little deeper. I found out that I could simply introduce new variables (let’s call them \gamma), and solve the following system instead

\begin{bmatrix} \mathbf{S}_\mathrm{s} & \mathbf{0} & \mathbf{P}^\mathrm{T} \\ \mathbf{0} & \mathbf{S}_\mathrm{s} & -\mathbf{I}^\mathrm{T} \\ \mathbf{P} & -\mathbf{I} & \mathbf{0} \end{bmatrix} \begin{bmatrix} \mathbf{a}_\mathrm{s} \\ \mathbf{a}_\mathrm{r} \\ \mathbf{\gamma} \end{bmatrix} = \begin{bmatrix} \mathbf{f}_\mathrm{s} \\ \mathbf{f}_\mathrm{r} \\ \mathbf{0} \end{bmatrix}.

That worked, so I mentally filed it under ‘Matrix Magic’ and never thought about it until much, much later.

By the way, that’s exactly the very same sliding interface condition that I mentioned in the numerical torque computation post.

Things occasionally go wrong with the sliding interface, by the way.
3D analysis

That time came when I was considering some 3D analysis, using the vector potential (\mathbf{A}) formulation. To get a unique solution, the following gauge condition should be satisfied

\nabla \cdot \mathbf{A} = 0.

I happened to know that an easy way to achieve this would be with Lagrange multipliers, again. So, it’d make sense that the final matrix equation would look like

\begin{bmatrix} \mathbf{S}_\mathrm{s} & \mathbf{C}^\mathrm{T} \\ \mathbf{C} & \mathbf{0} \end{bmatrix} \begin{bmatrix} \mathbf{a} \\ \mathbf{\gamma}\end{bmatrix} = \begin{bmatrix} \mathbf{f} \\ \mathbf{0} \end{bmatrix}.

In other words, simply add the constraint equation \nabla \cdot \mathbf{A} = 0 in matrix form, and then some matrix \mathbf{C} to couple them together, right?

Right?

Except it wouldn’t.

Why?

Now that’s the question.

Physical meaning of lil-L

And to understand that, we have dig deeper into the physical meaning of, well, everything. So not simply Matrix Magic anymore – yuck!

Let’s begin with the gauge condition \nabla \cdot \mathbf{A} = 0.

It’s there because the vector potential isn’t unique in 3D. We can add any gradient of a scalar potential g to it

\mathbf{A} \leftarrow \mathbf{A} + \nabla u

and still get the same field solution \mathbf{B} = \nabla \times \mathbf{A}.

It other words, A can be thought to contain an unknown gradient field.

Now, the correct approach is to add another include this gradient field as an unknown – to solve both \mathbf{A} and uand then require that their sum satisfies the gauge condition

\nabla \cdot ( \mathbf{A} + \nabla u)= 0.

By looking at the two equations, it’s quite easy to guess that the resulting matrix equation will look like

\begin{bmatrix} \mathbf{S}_\mathrm{s} & \mathbf{C}^\mathrm{T} \\ \mathbf{C} & \mathbf{G} \end{bmatrix} \begin{bmatrix} \mathbf{a} \\ \mathbf{u}\end{bmatrix} = \begin{bmatrix} \mathbf{f} \\ \mathbf{0} \end{bmatrix}.

So, we have an extra block \mathbf{G} in the lower right corner.

Furthermore, now we understand why everything is as it is. The Lagrance multipliers (now called \mathbf{u}!) aren’t an artificial constraint anymore. Instead, they directly define a potential u, in effect cancelling out the gradient part hidden inside A.

Original example

So, how does this relate to out original example

\begin{bmatrix} \mathbf{S}_\mathrm{s} & \mathbf{0} & \mathbf{P}^\mathrm{T} \\ \mathbf{0} & \mathbf{S}_\mathrm{s} & -\mathbf{I}^\mathrm{T} \\ \mathbf{P} & -\mathbf{I} & \mathbf{0} \end{bmatrix} \begin{bmatrix} \mathbf{a}_\mathrm{s} \\ \mathbf{a}_\mathrm{r} \\ \mathbf{\gamma} \end{bmatrix} = \begin{bmatrix} \mathbf{f}_\mathrm{s} \\ \mathbf{f}_\mathrm{r} \\ \mathbf{0} \end{bmatrix}?

Well, it turns out the multipliers \gamma have a clear physical meaning there as well. Specifically, the add an additional H_\mathrm{t} – tangential component of the magnetic field the airgap boundaries of the stator and rotor. Hence the appearance of the matrices \mathbf{P} and \mathbf{I} on the first two rows of the linear system.

Moreover, the tangential field is defined to be such that the solution is then continuous over the airgap interface. Thus the third, extra row.

Wondering why get the relatively weird tangential field? That’s simply a peculiarity of the vector potential. For many other problems, we’d see a normal component – such as a heat flux for thermal problems, or boundary force for mechanics.

Another case

Analysing an electric machine with circuit connections? Whether you know it or not (still using black-box commercial software?), some voltages are being solved along with the field quantities. And know what, these voltages are are in fact nothing more than Lagrance multipliers for the field problem.

Conclusion

  • Lagrance multipliers are a handy way of adding constraints to an FEA problem.
  • Despite their misleading name, the multipliers do have a physical meaning.
  • Blindly adding constraints (ignoring the point above) can lead to an incorrect solution.

The post Lagrange multipliers and their physical meaning appeared first on Antti Lehikoinen.

Leave a Reply