Although there are similar questions, I am also struggling with the implementation of the following term in "my own code" by Finite Element Method, namely, $\nabla \phi \cdot \nabla \phi$. $\phi$ is a state variable such as scalar potential. I think the descritization of this term is much more difficult than that of advection term in N-S equation. If possible, please tell me how to descritize and implement the term by FEM. The equation to solve is as follows, $\frac{\partial \phi}{\partial t} = (\nabla\phi)^2 + \nabla^2 \phi.$