Physics and Simulation of Nanoscale Electronic and Thermoelectric Devices