Numerical Simulation of a Thermoelectric Generator