Gravity dam as an important dam of water conservancy projects,has been widely used,but the dam section optimization has been a problem plagued the designer.Based on the nonlinear programming and the finite element method,the paper puts forward a set of ideas for the optimal design of the dam section,and proves the idea with the example.and the results show that the calculation results of fully meet the requirements,which can be used in the design of profile of gravity dam.