Weak form of an elliptic boundary value problem. I am studying finite elements and I am not understanding the higher-dimensional version of the weak form.
Say we have a BVP
\begin{align}
-\nabla \cdot (a(x,y) \nabla u(x,y)) + c(x,y) u(x,y) &= f(x,y), x \in \Omega \subset \mathbb{R}^2\\
(a(x,y) \nabla u(x,y)) \cdot \textbf{n}& = 0, \text{ for }(x,y) \in \partial \Omega.
\end{align}
The steps to get to the weak form are to


*

*Formally multiply the differential equation by a test function (x,y)

*Integrate both sides

*Apply a higher dimensional analogue of "integration by parts"

*Apply boundary conditions ("if necessary")


The notes I am using has this as their BVP (very similiar to mine)
\begin{align}
- \nabla \cdot (a(x,y)\nabla u(x,y)) + c(x,y) u(x,y) = f(x,y), x \in \Omega \subset \mathbb{R}^2, \\
u|_{\partial \Omega D} = g_D, \quad a\nabla u \cdot \textbf{n}|_{\partial \Omega N} = a \frac{\partial u}{\partial \textbf{n}} = g_N.
\end{align}
They skip to the weak form
\begin{align}
\text{Find $u \in S$ such that } \\
\int_{\Omega} (av_x u_x + av_y u_y + cvu) dxdy - \int_{\partial \Omega_N} vg_N ds = \int_{\Omega} vfdxdy, \\
\forall v \in T \text{ with } T=\{v \in H^1 (\Omega) : v|_{\partial \Omega_D} =  0 \}, \text{ and } S = \{v \in H^1 (\Omega) : v|_{\partial \Omega_D} =  g_D  \}.
\end{align}
Can anyone write out all the steps they used to get here, or explain how I could get to the weak form from my problem?
 A: Multiplying the given PDE by a test function $v\in T$ and integrating over the domain gives:
\begin{equation}
 \int_\Omega \Big[-v\nabla\cdot(a\nabla u) + cuv\Big]\, dxdy = \int_\Omega fv\, dxdy. \tag{1}
\end{equation}
We do not need to do anything with $\displaystyle\int_\Omega cuv\, dxdy$ and $\displaystyle\int_\Omega fv\, dxdy$ since they are already in the form of what we want, so we only need to investigate the first integral. Using integration by parts, we obtain
\begin{align*}
\int_\Omega v\nabla\cdot(a\nabla u)\, dxdy & = \int_{\partial\Omega} v(a\nabla u)\cdot\mathbf{n}\, ds- \int_\Omega \nabla v\cdot (a\nabla u)\, dxdy \\
& = \int_{\partial\Omega_D} v(a\nabla u)\cdot\mathbf{n}\, ds + \int_{\partial\Omega_N} v(a\nabla u)\cdot\mathbf{n}\, ds- \int_\Omega \nabla v\cdot (a\nabla u)\, dxdy.
\end{align*}
Now, since $v\in T$, $v|_{\partial\Omega_D} = 0$ and the first integral on the right vanishes. Since $u$ satisfies the given PDE, we have the boundary condition $a\nabla u\cdot\mathbf{n} = g_N$ on $\partial\Omega_N$. Thus, the above reduces to:
\begin{align*}
\int_\Omega v\nabla\cdot(a\nabla u)\, dxdy & = \int_{\partial\Omega_N} vg_N\, ds - \int_\Omega \nabla v\cdot a\nabla u\, dxdy \\
& = \int_{\partial\Omega_N} vg_N\, ds - \int_\Omega (au_xv_x + au_yv_y)\, dxdy, 
\end{align*}
and 
$$ \int_\Omega -v\nabla\cdot(a\nabla u)\, dxdy = \int_\Omega (au_xv_x + au_yv_y)\, dxdy -\int_{\partial\Omega_N} vg_N\, ds.$$
Hence, we obtain the required weak form by substituting the above equation into (1).
