Solve the below problem:
Q: A rigid 100-L tank contains air at 1 MPa, 200°C. A valve on the tank is now opened and air flows out until the pressure drops to 100 kPa. During this process, heat is transferred from a heat source at 200°C, such that when the valve is closed, the temperature inside the tank is 50°C. What is the heat transfer?