Electronic – LTSpice simulation of rectifier slows down after short time

ltspicerectifiersimulation

I have the following simple circuit set up in LTspice:
LTspice screenshot

Blue is on the output of the transformer and green from the rectifier.

If I don't include a capacitor this works fine and the simulation goes quickly. If I include the capacitor however the simulation becomes incredibly slow after a few milliseconds. The image shows up until it basically stops simulating at reasonable speed. The time at which it becomes slow seems to depend on the value of the capacitor

What is going on here?

NOTE: Solved by selecting 'alternate' solver in SPICE settings

Best Answer

The solver is essentially solving a system of differential equations, and there are various algorithms for doing this, some which work better that others depending on the conditions ("stiffness" of the equation - if you know e.g. Matlab/Scilab/Octave see the various ODE solvers there for different conditions)

Depending on the circuit, the solver may have a hard time coverging, and as the Photon says shortens the time scale until it basically just slows down and stops (sometimes if you leave it long enough it will complete the "difficult" part, but often not).
This often happens when ideal capacitive/inductive elements are present, so it's always a good idea to select a series resistance for an inductor (actually defaults to 1m) and also an ESR for a capacitor. Right click on the component to set these and other values (as you probably know)

One other thing is your voltage source appears to be floating from circuit ground - add a high value resistor across the transformer (e.g. 100Meg) Without a DC path it makes it hard for SPICE to determine the nodes voltage.

The last thing I notice about your circuit is you have not selected a "real" diode - this may cause issues also. Right click and select a diode from the list available, I imagine this combined with setting some reasonable value ESR for the cap (and maybe a little more for the inductors) will make it work for either solver.

The circuit below works fine with either solver (cap has 1m ESR):

Circuit Example

Simulation:

Simulation