Suppose the initial circuit is as in 1 on my sketch.
After all transients have died away the current through inductor L is V/R
The capacitor has an intial voltage of V on it
Then the swicth 1 opens and 2 closes
The inductor will supply current V/R to the capacitor depositing a charge Q.
However what i would like to know is, if the capacitor is rated at voltage V, what will happen?
Will the capacitor explode?
Short answer:
Yes if there is enough energy. No if there is only enough energy to
short it out and discharge the inductor and the remaining current
isnt enough to blow it up (depends on actual supply voltage internal
resistance).
Sometimes a cap will arc over and then seem to work ok after that too.
What you have there if you make R very low is basically a boost converter.
The voltage to the cap gets boosted up to a voltage higher than the
supply voltage. If the voltage is too high, the cap either blows out or
explodes.
I've seen large electrolytic caps blow up like cannons.
I remember back in one school i went to we used to blow up stuff just to
see what it would take...sort of like the Mythbusters of electronic parts.
We preferred resistors as they made a lot of smoke before they blew. With
enough energy though (mains) we could get them to pop like firecrackers.
This may sound like silly fun, but it actually taught me the dangers that can
come up when dealing with high energy and regular electronic components.
The possibility for personal injury is always a factor.
I've also seen high power metal case transistors blow from too much current
(huge overcurrent) and i can tell you that is not something you want your
eyes (or anything else for that matter) in line with. The HOT metal and si
go flying in all directions as the case melts and spews out.
Eye protection is a must.