In Ansys the traditional gravity dam section optimization method is usually a first-order or zero-order optimization and takes a long time.Variational optimization method as a new optimization method can quickly optimize computing and reduce computing costs and improve the calculation accuracy, but this approach has not been widely used in the hydraulic structure optimization. Through the grid with the move tool in ParaMesh the gravity dam downstream slope and the upstream slope point set to geometric design variables, the dam heel point don''t appear tensile stress and satisfy the stability against sliding for condition variables, the paper studied the application of variational technology in the gravity dam shape optimization research.After optimizing, the cross-sectional area of dam reduced by 27% to meet sliding stability and stress requirements, and the spending time of the method is less than one tenth of that of a traditional optimization methods. The results show that the variational technology in hydraulic structure optimization design is feasible, not only high precision, easy to operate, and the computation cost greatly reduced, the technology has great prospects in hydraulic structure optimization design .