We investigate in this paper a numerical method to control the temperature of an induction heating process through electric current parameters such as frequency and current voltage imposed to the terminals of the inductor. We seek a sinusoidal voltage function whose amplitude varies in time. For this, we use a two-dimensional induction heating model. that involves a phase transition in which the magnetic field has only one nonvanishing component. The procedure can be extended to more sophisticated models without major modification of the optimal control problem. We present a numerical control algorithm and discuss numerical experiments that prove the efficiency of the procedure.