LTSpice - Inductance simulation

Welcome back on this subject :

I would like to simulate an inductance which varies linearly in function of the current which flows through it. Suppose : $$L(t) = I_{L}(t)$$ In the simulation for simplicity I used a current source which has a slope of current equal to : $$\frac{dI_{L}(t)}{dt} = 1$$ So : $$U_{L}(t) = L(t)\frac{dI_{L}(t)}{dt} = L(t) = I_{L}(t)$$

Finally the expression of the Flux for L should be : $$Flux(t) = x^2/2$$

Refere to this link for the expression of the flux : LTspice - Simulation of a variable inductance

So here is the simulation :

And here are the result :

What is weird to me is that I have to add a minus sign in the expression of the flux of the inductance. Why ?

Thank you very much.

• Are you certain that the direction you assumed for the inductor current is the same as the direction that LTspice assumes? Dec 28, 2020 at 13:10
• You mean what is the sign of "x" ? I assume "x" has the same sign that I(L2)
– Jess
Dec 28, 2020 at 13:17
• Looking at the graphs of voltage and current, congratulations on creating a 1 ohm resistor and dissipating 10 MW in R1. Dec 28, 2020 at 13:23
• Thank you for your point :D
– Jess
Dec 28, 2020 at 14:05

Inductors have phase in LTspice. If you rotate the inductor 180°, you will no longer need to multiply by -1.

It can also be helpful to use the inductor symbol with a phasing dot. Here is the correct orientation that will remove the need for multiplying by -1:

• You are right ! Thank you :) Nevertheless I have to put the phasing dot in the reverse direction with repest to you phasing dot
– Jess
Dec 28, 2020 at 14:39

I can only assume that the convention of flux is just defined like that. It should not really matter either, as depending on how you are coiling your inductor (left-hand or right-hand coil), the effect of any externally defined flux inverts. However, since you are using a square, you are losing that "direction", so you have to worry about something that you usually don't really need to worry about.

If you want a more "generic" solution, replace the flux expression with:

$$Flux = sgn(x)*(x**2)/2$$

This makes it irrespective of the inductor polarity again.