Change in entropy of the Universe for charging/discharging a capacitor I just need to know what exactly happens when charging/discharging a capacitor. Is there any heat transfer between the capacitor and the surroundings? Is there a heat transfer between other parts of the surroundings (wires, the battery)? 
Another thing I don't understand generally... How do we know if a process is reversible or irreversible? Should we take the third law of thermodynamics as a principle and calculate the change in the entropy of the Universe through the formula given for entropy? If so, how about a process like the free expansion of a gas in which there is no heat transfer but the entropy increases? What about an adiabatic process? Where is the start point for calculating the change in entropy of the Universe for charging/discharging a capacitor?
 A: All energy transfer in an (ideal linear) electrical circuit is a form of work. Its just moving charges in electromagnetic fields. Resistor transfer energy to something external to the circuit, and often this energy will end up dissipated as heat in the surroundings. Inductors and capacitors, however, simply store energy and then release it again. Work is done charging them up and work is done discharging them, but there is no heat transfer. 
In thermodynamics a process is reversible if it can be reversed by an infinitesimal change in the conditions, in other words everything is at the same temperature, pressure, etc (give or take an infinitesimal difference so that something actually happens) If energy is conserved in our process them the sum of all the heat transferred between different parts of our system must be 0. If, for a reversible change, everything is at the same temperature and \begin{equation} \mathrm{d}S = \frac{\mathrm{d}Q_{rev}}{T}\end{equation} This implies that the total change in entropy must also be 0.
A: For charging a capacitor, it is true that dQ/T is zero, but the entropy is ds=dQ/T + dW/T by using the fundamental equation dU=TdS-PdV. PdV is simply the work done. The battery does work to store that energy so S is not zero. 
