Theory of TEM diode switching