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 : enter image description here

And here are the result : enter image description here

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.

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

2 Answers 2


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:

enter image description here

  • \$\begingroup\$ You are right ! Thank you :) Nevertheless I have to put the phasing dot in the reverse direction with repest to you phasing dot \$\endgroup\$
    – 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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.