# Finite Elements Weak Formulation generalization

I am struggling with an equation that represents the Weak form of Galerkin method:

$\phi^{T}F(\textbf{u})\sim \int_{\Omega}^{ } \phi.f_{0}(\mathit{u},\nabla \mathit{u}) + \nabla\phi:f_{1}(\mathit{u},\nabla \mathit{}u) = 0$

Where the pointwise functions $f_{0}$ and $f_{1}$ capture the problem physics. After discretizing:

$F(\textbf{u}) \sim \sum_{e}^{} \Large \varepsilon _{e}^{T} \normalsize \left[ B^{T}Wf_{0}(u^{q},\nabla u^{q}) + \sum_{k}^{}D_{k}^{T}Wf_{1}^{k}(u^{q},\nabla u^{q}) \right ]$

Where $u^{q}$ is the vector field evaluations at the set $q$ of quadrature points on an element, $W$ is the diagonal matrix of the quadrature weights, B and D are basis function matrices and $\Large\varepsilon _{e}$ is the element restrictor operator.

I don't understand these equations, in particular the first one. Does anyone knows how this was derived? At least the first one, since it represents the weak formulation that I must really understand.

## Continuous weak form

Though I think the weak form is more fundamental, suppose we start with the strong divergence-form representation for a (first- or) second-order quasilinear PDE: find the $m$-component solution $u \in R^m(\Omega)$

$$-\nabla \cdot f_1(u,\nabla u) + f_0(u,\nabla u) = 0$$

on the domain $\Omega \subset R^d$ with (for simplicity) homogeneous Dirichlet boundary condition $u|_{\partial \Omega} = 0$. The function $f_1 : R^m \times R^{m\times d} \to R^{m\times d}$ defines a "conservative" flux and $f_0 : R^m \times R^{m\times d} \to R^m$ is a source term (including non-conservative transport).

If the strong form above is true, it must also be the case that for all test functions $\phi \in R^m(\Omega)$,

$$\int_\Omega \phi \cdot \Big(- \nabla \cdot f_1 + \cdot f_0 \Big) = 0 .$$

Integrating by parts and using the fact that $u = 0$ on the boundary, we see that

$$\int_\Omega \nabla \phi :\, f_1 + \phi \cdot f_0 = 0,$$

which is the equation in your question.

## Discretization

When we discretize, we choose a finite number of test functions for which to satisfy the weak form. Each test function produces one equation. The solution space is also discretized, typically with the same number of degrees of freedom (Galerkin methods equate the test space with the ansatz space). If we express the test and trial functions in a basis $\{ e_1, e_2, \dotsc, e_n \} \subset R^m(\Omega)$, we have a set of equations

$$\int_\Omega \nabla e_i :\, f_1(u_h,\nabla u_h) + e_i \cdot f_0(u_h, \nabla u_h) = 0, \quad i \in \{1, \dotsc, n \}$$

where the discrete solution $u_h$ is expressed in the same basis, $u_h =\sum_i u^i e_i$. We can enumerate the left side of the above equations as

$$F^i(\mathbf u) = 0, \quad i \in \{1, \dotsc, n\}$$

where $\mathbf u = \{u^1, \dotsc, u^n\} \in R^n$, forming a vector $\mathbf F = \{F^1,\dotsc,F^n\} \in R^n$. Note that we have selected a basis and now deal only with components. The discrete equations are thus completely represented by the (linear or nonlinear) function $\mathbf F : R^n \to R^n$, mapping discrete vectors $\mathbf u$ in the ansatz space to residual vectors.

Solving $\mathbf F(\mathbf u)=0$ is equivalent to saying

$$\mathbf\phi^T \mathbf F(\mathbf u) = 0$$

for all test functions $\mathbf\phi \in R^n$. Each of these discrete equations is a statement of the continuous weak form for $\phi_h = \sum_i \phi^i e_i$ and $u_h = \sum_i u^i e_i$. This relationship inspires my notation that the discrete form corresponds ($\sim$) to the continuous equation $$\mathbf\phi^T \mathbf F(\mathbf u) \sim \int_\Omega \nabla \phi_h :\, f_1(u_h,\nabla u_h) + \phi_h \cdot f_0(u_h, \nabla u_h) = 0 .$$

## Implementation

In practice, the integrals are usually evaluated by quadrature on each element (and the finite-element basis functions $e_i$ have compact support only on the adjacent elements). I like the notation in the second equation of your question because it highlights the linear and nonlinear components and corresponds to a good way to organize code for a flexible and efficient implementation.

• The standard books that everyone reads are far away from what is needed to understand this subject in the way explained. At least I understood it now. But, to enhance my knowledge beyond the standard literature, can you suggest some book references? – Pedro R. Jul 17 '14 at 22:04
• What are the books that you have read so far? – nicoguaro Jul 18 '14 at 2:41
• T.J. Chung and Zienkiewic for Continuous Galerkin and Ben Q. Li for DG. – Pedro R. Jul 18 '14 at 4:44