I'm trying to write a code solving the Dirichlet boundary problem for $p$-Laplacian on an arbitrary planar domain $\Omega$: $$\begin{cases} -\Delta_p (u) = f \text{ on } \Omega, \\ u\big|_{\partial \Omega} \equiv 0 \end{cases} $$ using finite-elements method. I rely on classical formulation by Barret, Liu 1993: https://www.ams.org/journals/mcom/1993-61-204/S0025-5718-1993-1192966-4/S0025-5718-1993-1192966-4.pdf The variational formulation proposed there is as follows: given a finite-element continuous piecewise-linear basis functions, minimize $$ J(u) = \frac{1}{p} \int_{\Omega} |\nabla u|^p \: d\Omega - \int_{\Omega} fv \: d\Omega $$ The authors used conjugated gradient method for their calculations. Due to my lack of experience (I've not studied non-linear optimization yet), I'm stuck with determining what exactly I should take as $\nabla J$. There's an explicit expression for $J$'s Gateaux derivative: $$ J'(u)(v) = \int_{\Omega} |\nabla u|^{p-2} \langle \nabla u, \nabla v \rangle \: d\Omega - \int_{\Omega} fv \: d\Omega $$ so, by the analogy with $\mathbb{R}^n$, where a gradient is just a vector of directional derivatives along coordinate directions, I've thought maybe I should just compute $J'(u)$ along my finite-element basis functions directions: $\nabla J(u) = \langle J'(u)(\varphi_1), \dots, J'(u)(\varphi_N)\rangle$, but that sounds completely random and theoretically weird. At the other side, using linearity of my basis, I can express $J\big(\sum \lambda_i \varphi_i\big)$ as a simple function of $(\lambda_1, \dots, \lambda_N)$, equal something like $$\bigg[\sum_{i=1}^{K(\Delta)} \lambda_{\Delta_i}^{2}(a_{\Delta_i}^2 + b_{\Delta_i}^2)\bigg]^{p/2} \cdot ||\Delta||$$ at each triangular mesh element $\Delta$, so one can easily get $\frac{\partial J}{\partial \lambda_i}$ for each $\lambda_i$. I've also came across some Riesz representation-related definitions (a gradient is the Riesz representation of $J'$), but I have no idea what that means technically.
Could someone give me a clue what is the right way to compute $\nabla J$? I would be also very greatful for some reading recommendatons. Thank you!