A dynamic model of the resistance heater element in a thermal flying height control (TFC) slider of a hard disk drive is identified and used for dynamic flying height control. Experimental data obtained on a spin stand and a generalized realization algorithm are used for identification of a discrete-time dynamic model of the thermal actuator. The flying height change is measured in two different ways: using servo burst information written onto the disk surface and using information written in the data sectors only. The resistance change of the thermal actuator based on the input power level is measured. Based on the identified discrete-time model of the heater and using convex optimization techniques, a computational scheme is proposed to obtain optimized feedforward input profiles to the heater element that minimize repeatable flying height variations and enable low flying heights.