# Numerical integration in Finite Element Method (and implementation in Matlab)?

i'm trying to solve the p-Laplace Equation:

\begin{align} \begin{cases} \text{div} (\sigma |\nabla u|^{p-2} \nabla u) = f &\quad \text{in } \Omega\\ u = g &\quad \text{in } \partial\Omega \end{cases} \end{align}

by using the finite element method and minimizing

\begin{align} \label{J} J(v) = \frac{1}{p}\int_{\Omega} \sigma |\nabla v|^p~\mathop{}\!\mathrm{d} x - \int_{\Omega} fv~\mathop{}\!\mathrm{d} x \end{align}

with Newton-Ralphson. Therefore i need to calculate

\begin{align} J'(v) = \int_{\Omega} \sigma |\nabla v|^{p-2} \nabla v \nabla \varphi~\mathop{}\!\mathrm{d} x - \int_{\Omega}f\varphi ~\mathop{}\!\mathrm{d} x \end{align}

and

\begin{align} J(v)'' = \int_{\Omega} [(p-2) |\nabla v|^{p-4} ( \nabla v \cdot \nabla \varphi) \nabla v + |\nabla v|^{p-2} \nabla \varphi] \nabla \phi \end{align}

where $$\varphi, \phi \in W^{1,p}_0$$.

I know that i have to integrate over a triangulation, BUT...

How do i mathematically calculate/implement the needed expression $$\nabla v$$, $$\nabla \varphi$$ (the basis functions will be the hat/pyramid functions) and then integrate over the triangles?

Can someone help me, recommend me a book, a website or maybe even know an example code for such a problem?

• If the basis is piecewise linear, then $\nabla v$, $\nabla\varphi$ etc. are constant over each element. So to integrate you just have to compute the values per element and multiply by the volume of the element. – Rahul Nov 10 '18 at 14:37
• ah okay! yes, the basis are piecewise linear, so of course the gradient has to be constant... do you mean area of a triangle by "volume of the elemente"? – superdave99 Nov 13 '18 at 22:13
• Yes, if you are in 2D then it's the area of the triangle. – Rahul Nov 14 '18 at 3:39
• Thanks! But how do i handle the right part $\int f \varphi$? – superdave99 Nov 15 '18 at 20:49
• It depends on the form of $f$, but in general you will need some kind of quadrature scheme. For piecewise linear elements, I think it's sufficient to just sample at the mesh vertices, but for a more authoritative answer try asking on scicomp.stackexchange.com. – Rahul Nov 16 '18 at 5:09