Minimization principle for shear alignment of liquid crystals.