I'm not sure what you are working on, but I have this LC circuit I built for working with Wireless Power Transfer simulations.
The square wave I use to trigger the O-scopes. There is an odd looking part of the circuit with a 400k resistor that I had to add to tie the AC circuit to ground or the system would not solve.
I think you will find this easy to modify. You set the peak voltage, main inductor value and switching frequency and it automatically calculates the resonant cap size.
The Green line is the tank current and the blue line is the power supply voltage. The yellow line that can barely be seen is the input current from the power supply. It looks like the green and blue lines are 90 degrees out of phase meaning that all power is reactive which is in a way 100% efficient because the cap and inductor are bouncing the power back and forth.
If you want to operate off of resonance then change the 1.0 highlighted below to some other ratio and you will see that the yellow line shoots up.
I think that the increase in input current shown by the yellow line indicates that the blue and green waves are no longer 90 degrees out of phase and that the amount of active power that comes from the power supply is now going up. I haven't had a chance to look into this in detail, I'm still on the learning curve and focused on other things right now.
Let me know if this helps and anything interesting that you learn.
i'm trying to simulate this circuit: https://en.wikipedia.org/wiki/LC_circuit
you have a sinusoidal source voltage, and i just using a dc voltage with a switch. I switch on the interruptor and i charge the capacitor, Then i switch off the interruptor and the capacitor transmit the current to the inductor and the circuit should start to oscillate.
This attached circuit does what you asked for. It uses the an initial charge on the capacitor to set the circuit in motion.
The file is misnamed because without any parasitic losses there is no decay. You should add a series resistor to represent parasitic losses and then the circuit will decay.