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?