Thermal flying-height control (TFC) sliders have been used for active flying height control of hard disk drives. It is of particular interest to investigate if TFC sliders can be used to minimize both repeatable and nonrepeatable flying height variations. To that end, the power input to the heater must be dynamically optimized at each time step in order to minimize changes in flying height. In the current study, a numerical procedure is implemented to simulate the time dependent response of a TFC slider to changes of the heater element power input. The dynamic Reynolds equation and slider equilibrium equations are solved simultaneously to determine the dynamic change in flying height as a function of time. The change of thermal protrusion as a result of the optimized power input to the heater is computed using a TFC slider finite element model. The reduction of flying height variation is studied using past and present flying height histories and optimization of the power input to the heater. It is shown that the dynamic approach can be successfully used to minimize both repeatable and nonrepeatable flying height changes at the hard disk interface.