The number r can be interpreted as the number of photons in the mode. For r = 0 the energy of the mode is not zero. This vacuum energy of the electromagnetic field is responsible for the Casimir effect. In the following we will calculate the internal energy of the box at absolute temperature T.