A solenoid of inductance L with resistance r is connected in parallel to a resistance R. A battery of emf E and of negligible internal resistance is connected across the parallel combination as shown in the figure. At the time t=0, switch S is opened, calculate amount of heat generated in the solenoid.