  We study the heat generation in a nano-device with an electric current
passing through the device. For the first time, a general formula for the heat
generation is derived by using the nonequilibrium Keldysh Green functions. This
formula can be applied in both the linear and nonlinear transport regions, for
time-dependent systems, and with multi-terminal devices. The formula is also
valid when the nano-device contains various interactions. As an application of
the formula, the heat generation of a lead-quantum dot-lead system is
investigated. The dc and ac biases are studied in detail. We find several
interesting behaviors that are unique to nanostructures, revealing significant
difference from heat generation in macroscopic systems.
