FEM for Elliptic equations with gradient term I have a question about the following problem.
Let
$-\Delta u = \|\nabla u\|^p+f$ in $B(0,1)$,
$u=0$ on $\partial B(0,1)$,
where $B(0,1)\subset\mathbb{R}^2$ is a bounded regular domain, $f$ is nonnegative measurable function and $p>1$.
$\|\cdot\|$ denotes the euclidean norm.
I want to numerically study this problem using Finite Elements method.
We consider an admissible triangulation $\mathcal{T}$ of $B(0,1)$.
The disrete variational formulation is given by : Find $u\in V_h$ s.t
$a(u,\phi)=\int_{B(0,1)} \|\nabla u\|^p \phi +\int_{B(0,1)} f\phi$, $\phi\in V_h$,
where $V_h\subset H^1_0(B(0,1))$ is of finite dimension.
We approximate the solution by $u_h\approx \sum_{i=1}^n u_i \varphi_i$ where $\varphi_i$ are basis functions. Also, we take is particular $\phi=\varphi_j$, $j=1,...n$.
My question is how to deal with the term $\int_{B(0,1)} \|\nabla u_h\|^p \phi_j$
$=  \int_{B(0,1)} \|\sum_{i=1}^n u_i \nabla \varphi_i\|^p \varphi_j $.
When I take an element (a triangle) $T$ of $\mathcal{T}$, I have that $\int_T \|\ 
  u_1 \nabla \varphi_1 + u_2\nabla \varphi_2   + u_3 \nabla \varphi_3   \|^p \varphi_j$.
But then I don't know how to assemble the vectors.
Can someone please clear this point up?
Thank you.
 A: According to your comment, the question is how to put local integrated vector in global system of equations. In your case, we are interested in putting in in right hand side vector of the discrete linear system.
Every finite element (triangle in this case) has associated degrees of freedom (3 in case of first order scalar triangle). Degrees of freedom can be just ids of nodes in case of scalar problems. You want to add coefficients of local vector to coefficients of global vector at the right indices. Those indices are the degrees of freedom.
Lets say that your element $T$ has degrees of freedom $\left[d_1,d_2,d_3\right]$, $d_*$ are integers. Assembled local vector is $\mathbf{v}_{T} \in \mathbb{R}^3 $. Global vector is denoted by $\mathbf{v}_g \in \mathbb{R}^N$, where $N$ is global number of degrees of freedom (in scalar case it is usually number of nodes mesh before we apply boundary conditions).
To put them in the global vector we just update its three indices:
$$\mathbf{v}_{g,d_1} \rightarrow \mathbf{v}_{g,d_1} + \mathbf{v}_{T,1}$$
$$\mathbf{v}_{g,d_2} \rightarrow \mathbf{v}_{g,d_2} + \mathbf{v}_{T,2}$$
$$\mathbf{v}_{g,d_3} \rightarrow \mathbf{v}_{g,d_3} + \mathbf{v}_{T,3}$$
We are done. See example 4.11 (pg 185) of this book for more insight:
https://web.mit.edu/kjb/www/Books/FEP_2nd_Edition_4th_Printing.pdf
