FEM gradient descent