I was trying to set an initial voltage for a capacitor I was modeling in LT Spice, and I tried using the command .ic V(Vc)=20000 (Vc is the node directly after the capacitor, with ground on the other side), but the result it gave me was like this: Circuit schematic: There is a AC square wave source, but this is the part being measured. I figured that it would be more of a consistent curve, but it looks like it just immediately jumps and then discharges as I think it should. Is there another way to give a capacitor an initial voltage?
If you look closely, there is an initial spike of whatever you imposed it to be, but then the voltage discharges quickly through
D1 to ground. The circuit is behaving normally, I'd say. BTW, you named the same node twice:
Vc. In this case, LTspice will consider the last placed name.
Else, for any circuit involving initial conditions, you can try adding
.tran 10m uic to complement the
.ic card. Or delete the
.ic card and set
ic=... next to
C1's value, like this:
2n ic=20k (btw, those
F do nothing, unless they are the first letter, when it means
femto -- avoid units). This should work without
The problem with this circuit is all the wires are superconducting and the caps (most likely) do not have any parasistics attached. If you have a cap with no ESR or ESL and a wire with no resistance, the current in circuits like this can go to infinity and the solver will have a difficult time finding initial conditions.
Make sure you have appropriate values of ESR and ESL, you can do this by looking up a capacitor of comparable size datasheet, or by estimation.