This program was contributed by Andrea Bonito (Texas A&M University) and Diane Guignard (University of Ottawa).
This material is based upon work supported by the National Science Foundation under Grant No. DMS-1817691. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.
Note
If you use this program as a basis for your own work, please consider citing it in your list of references. The initial version of this work was contributed to the deal.II project by the authors listed in the following citation:
Introduction
Problem Statement
In this example, we consider the local discontinuous Galerkin (LDG) method for approximating the solution to the bi-Laplacian problem,
where is an open bounded Lipschitz domain and . This is the same problem we have already considered in step-47, but we will take here a different approach towards solving it: Rather than using continuous finite elements and the interior penalty method, we consider discontinuous finite elements and the local discontinuous Galerkin method defined using lifting operators.
The weak formulation of this problem reads as follows: find such that
where denotes the Hessian of and . Using so-called lifting operators as well as the Nitsche approach to impose the homogeneous Dirichlet boundary conditions, the LDG approximation of this problem consists of replacing the Hessians by discrete Hessians (see below) and adding penalty terms involving properly scaled jump terms. In particular, the versatility of the method described below is of particular interest for nonlinear problems or problems with intricate weak formulations for which the design of discrete algorithms is challenging.
Discretization
Finite element spaces
For , let be a partition of into quadrilateral (hexahedral if ) elements of diameter and let denote the set of (interior and boundary) faces. We restrict the discussion to conforming subdivisions to avoid technicalities already addressed in previous tutorials. The diameter of is denoted . For any integer , we introduce the (discontinuous) finite element space
where is the map from the reference element (unit square/cube) to the physical element . For , the piecewise differential operators are denoted with a subscript , for instance and . For , we assign a normal . The choice of normal is irrelevant except that when is a boundary face, is the normal pointing outward .
Jumps, averages, and discrete reconstruction of differential operators
The piecewise differential operators do not have enough information to be accurate approximations of their continuous counterparts. They are missing inter-element information.
This leads to the introductions of jump and average operators:
respectively, where and are the two elements adjacent to so that points from to (with obvious modification when is a boundary edge). These are the same operators that we have previously used not only in step-47, but also in other tutorials related to discontinuous Galerkin methods (e.g., step-12).
With these notations, we are now in position to define the discrete/reconstructed Hessian of ; that is, something that will take the role of in the definition of the weak formulation above when moving from the continuous to the discrete formulation. We first consider two local lifting operators and defined for by, respectively,
and
We have , where denotes the patch of (one or two) elements having as part of their boundaries.
The discrete Hessian operator is then given by
Note
In general, the polynomial degree of the finite element space for the two lifting terms do not need to be the same as the one used for the approximate solution. A different polynomial degree for each lifting term can also be considered.
Note that other differential operators (e.g., gradient or divergence) can be reconstructed in a similar fashion, see for instance [DiPietro2011].
Motivation for the lifting operators
The discrete Hessian is designed such that it weakly converges to the continuous Hessian , see the note in the next section for a precise statement. As already mentioned above, the broken Hessian is not a suitable candidate as it contains no information about inter-element jumps. We provide here an informal discussion motivating the definition of the two lifting operators and we refer to [Pryer2014] and [Bonito2021] for more details (although the definitions are slightly different unless the mesh is affine). The goal is then to construct a discrete operator such that for all we have
for any sequence in such that in as for some . Let . Integrating by parts twice we get
while
Now, we integrate two times by parts the left term, taking into account that is not necessarily continuous across interior faces. For any we have
where denotes the outward unit normal to . Then, summing over the elements and using that is smooth, we obtain
which reveals the motivation for the definition of the two lifting operators: if was an admissible test function, then the right-hand side would be equal to and we would have shown the desired (weak) convergence. Actually, if we add and subtract , the Lagrange interpolant of in , we can show that the right-hand side is indeed equal to up to terms that tends to zero as under appropriate assumptions on .
It is worth mentioning that defining without the lifting operators and for would not affect the weak convergence property (the integrals over boundary faces are zero since is compactly supported in ). However, they are included in to ensure that the solution of the discrete problem introduced in the next section satisfies the homogeneous Dirichlet boundary conditions in the limit .
LDG approximations
The proposed LDG approximation of the bi-Laplacian problem reads: find such that
where
Here, are penalty parameters.
Let be the standard basis functions that generate . We can then express the solution as and the problem reads: find such that
where and are defined by
Note
The sparsity pattern associated with the above LDG method is slightly larger than that of, e.g., the symmetric interior penalty discontinuous Galerkin (SIPG) method. This is because the lifting operators in extend shape functions defined on one cell to the neighboring cell where it may overlap with the lifted shape functions from a neighbor of the neighbor. However, we have the following interesting properties:
The bilinear form is coercive with respect to the DG norm
for any choice of penalty parameters . In other words, the stability of the method is ensured for any positive parameters. This is in contrast with interior penalty methods for which they need to be large enough. (See also the discussions about penalty parameters in the step-39, step-47, and step-74 programs.)
If is a sequence uniformly bounded in the norm such that in as for some , then the discrete Hessian weakly converges to in as . Note that the uniform boundedness assumption implies that the limit belongs to .
The use of a reconstructed operator simplifies the design of the numerical algorithm. In particular, no integration by parts is needed to derive the discrete problem. This strategy of replacing differential operators by appropriate discrete counter-parts can be applied to nonlinear and more general problems, for instance variational problems without a readily accessible strong formulation. It has been used for instance in [BGNY2020] and [BGNY2021] in the context of large bending deformation of plates.
As in step-47, we could consider finite element approximations by replacing FE_DGQ<dim> by FE_Q<dim> (and include the appropriate header file deal.II/fe/fe_q.h) in the program below. In this case, the jump of the basis functions across any interior face is zero, and thus for all , and could be dropped to save computational time. While an overkill for the bi-Laplacian problem, the flexibility of fully discontinuous methods combined with reconstructed differential operators is advantageous for nonlinear problems.
Implementation
As customary, we assemble the matrix and the right-hand side by looping over the elements . Since we are using discontinuous finite elements, the support of each is only one element . However, due to the lifting operators, the support of is plus all the neighbors of (recall that for , the support of the lifting operators and is ). Therefore, when integrating over a cell , we need to consider the following interactions (case )
dofs dofs
(stored in stiffness_matrix_cc)
dofs dofs
(stored in stiffness_matrix_cn and stiffness_matrix_nc)
dofs dofs
(stored in stiffness_matrix_nn)
dofs dofs ,
(stored in stiffness_matrix_n1n2 and stiffness_matrix_n2n1)
The last of these accounts that the lifted shape functions from one of the neighbor cells may overlap on with the lifted shape functions of another neighbor cell, as mentioned above. In other words, we need to compute the discrete Hessian of all the basis functions with support on as well as all the basis functions with support on the neighboring cells of . This is done in the function compute_discrete_hessians. A cell can have fewer than four neighbors (six when ) when at least one face is part of the boundary of the domain. It can also have more neighbors when hanging nodes are present. To simplify the presentation we do not discuss the latter.
Due to the local support of the basis functions, many of the terms of the discrete Hessian are zero. For any basis function with support on we have only if , and similarly for . Therefore, the discrete Hessian of reduces to
Furthermore, since we integrate on , we only need to evaluate the discrete Hessian at quadrature points that belong to , namely . We store this information in
where n_dofs = fe_values.dofs_per_cell is the number of degrees of freedom per cell and n_q_points = quad.size() is the number of quadrature points on . For any basis function with support on a neighboring cell, the discrete Hessian evaluated on contains only the two lifting terms, but not the term involving , since . Moreover, only the lifting over the common face is nonzero on , namely for all
This information is stored in
where n_dofs and n_q_points are as above, and n_faces = GeometryInfo<dim>::faces_per_cell is the number of faces of . As we shall see in the next section, we will only need to solve half of the local problems for the lifting terms.
Note
The variable discrete_hessians_neigh is of size n_faces x n_dofs x n_q_points. However, we only need to consider the interior faces, namely we do not need to fill discrete_hessians_neigh[face_no][i][q] whenever face_no corresponds to a boundary face. We could then save a little bit of storage by considering with n_faces the actual number of neighboring cells, i.e., not counting the boundary faces. By doing so, we could also avoid testing if a face lies on the boundary in the assembly of the matrix.
Computation of the lifting terms
We now describe the computation of the lifting operators and on each cell . This turns out to be a bit cumbersome, but it follows similar schemes as other reconstruction operators – see, for example, the "weak Galerkin" approach on step-61 or the "hybridizable discontinuous Galerkin" method in step-51. We focus on for an interior face , but the other cases are treated similarly.
We have for some neighbor of . For a basis function with support on or (for the other basis functions we have ), we write as
where and are the basis functions of which have support on and , respectively. The coefficients of the lifting operator are obtain upon solving the linear system
where the components of the (local) mass matrix and the right-hand side are given respectively by
Note that this system has the decoupled form
with , , , and .
In fact, since we evaluate the discrete Hessians at quadrature points and for , we have
As a consequence, only the coefficients , , are needed.
To compute the components , , we take advantage of the relation
where (resp. ) denotes the outward unit normal to (resp. ). Therefore, if , namely has support on the current cell , then
while if , namely has support on the neighboring cell , then
The factor comes from the average operator as is assumed to be an interior face.
Test case
The performance of the numerical algorithm will be assessed using a manufactured solution given by
if , while if we take
For different values of , we will report the error measured in the discrete metric (defined above but extended to piecewise functions), the discrete metric
as well as the metric.
The commented program
Include files
All the include files have already been discussed in previous tutorials.
 #include <deal.II/grid/tria.h>
 #include <deal.II/grid/grid_generator.h>
 #include <deal.II/grid/tria_accessor.h>
 #include <deal.II/grid/tria_iterator.h>
Â
 #include <deal.II/dofs/dof_handler.h>
 #include <deal.II/dofs/dof_accessor.h>
 #include <deal.II/dofs/dof_tools.h>
Â
 #include <deal.II/fe/fe_dgq.h>
 #include <deal.II/fe/fe_values.h>
 #include <deal.II/fe/fe_system.h>
Â
 #include <deal.II/base/quadrature_lib.h>
 #include <deal.II/base/function.h>
Â
 #include <deal.II/numerics/data_out.h>
Â
 #include <deal.II/lac/vector.h>
 #include <deal.II/lac/full_matrix.h>
 #include <deal.II/lac/sparse_matrix.h>
 #include <deal.II/lac/dynamic_sparsity_pattern.h>
The following three header files are for the solvers. The linear system is solved using a direct method while the conjugate gradient method is used to solve the local problems for the lifting terms.
The main class of this program is similar to that of step-3 or step-20, as well as many other tutorial programs. The key function here is compute_discrete_hessians() which, as its name suggests, computes the discrete Hessians needed for the assembly of the matrix .
 template <int dim>
 class BiLaplacianLDGLift
 {
 public:
 BiLaplacianLDGLift(constunsignedint n_refinements,
 constunsignedint fe_degree,
 constdouble penalty_jump_grad,
 constdouble penalty_jump_val);
Â
 void run();
Â
 private:
 void make_grid();
 void setup_system();
 void assemble_system();
 void assemble_matrix();
 void assemble_rhs();
Â
 void solve();
Â
 void compute_errors();
 void output_results() const;
Â
As indicated by its name, the function assemble_local_matrix() is used for the assembly of the (local) mass matrix used to compute the two lifting terms (see the matrix introduced in the introduction when describing the computation of ). The function compute_discrete_hessians() computes the required discrete Hessians: the discrete Hessians of the basis functions with support on the current cell (stored in the output variable discrete_hessians) and the basis functions with support on a neighbor of the current cell (stored in the output variable discrete_hessians_neigh). More precisely, discrete_hessians[i][q_point] stores , where is a basis function with support on cell, while discrete_hessians_neigh[face_no][i][q_point] stores , where is a basis function of the neighboring cell adjacent to the face face=cell->face(face_no).
 void assemble_local_matrix(constFEValues<dim> &fe_values_lift,
We also need a variable that describes the finite element space used for the two lifting operators. The other member variables below are as in most of the other tutorial programs.
In the constructor, we set the polynomial degree of the two finite element spaces, we associate the corresponding DoF handlers to the triangulation, and we set the two penalty coefficients.
 template <int dim>
 BiLaplacianLDGLift<dim>::BiLaplacianLDGLift(constunsignedint n_refinements,
To build a mesh for , we simply call the function GridGenerator::hyper_cube and then refine it using refine_global. The number of refinements is hard-coded here.
 template <int dim>
 void BiLaplacianLDGLift<dim>::make_grid()
 {
 std::cout << "Building the mesh............." << std::endl;
In the following function, we set up the degrees of freedom, the sparsity pattern, the size of the matrix , and the size of the solution and right-hand side vectors and . For the sparsity pattern, we cannot directly use the function DoFTools::make_flux_sparsity_pattern (as we would do for instance for the SIPG method) because we need to take into account the interactions of a neighboring cell with another neighboring cell as described in the introduction. The extended sparsity pattern is built by iterating over all the active cells. For the current cell, we collect all its degrees of freedom as well as the degrees of freedom of all its neighboring cells, and then couple everything with everything.
 template <int dim>
 void BiLaplacianLDGLift<dim>::setup_system()
 {
 dof_handler.distribute_dofs(fe);
Â
 std::cout << "Number of degrees of freedom: " << dof_handler.n_dofs()
At the end of the function, we output this sparsity pattern as a scalable vector graphic. You can visualize it by loading this file in most web browsers:
 std::ofstream out("sparsity-pattern.svg");
 sparsity_pattern.print_svg(out);
 }
Â
Â
Â
BiLaplacianLDGLift::assemble_system
This function simply calls the two functions responsible for the assembly of the matrix and the right-hand side.
 template <int dim>
 void BiLaplacianLDGLift<dim>::assemble_system()
 {
 std::cout << "Assembling the system............." << std::endl;
Â
 assemble_matrix();
 assemble_rhs();
Â
 std::cout << "Done. " << std::endl;
 }
Â
Â
Â
BiLaplacianLDGLift::assemble_matrix
This function assembles the matrix whose entries are defined by which involves the product of discrete Hessians and the penalty terms.
We now compute all the discrete Hessians that are not vanishing on the current cell, i.e., the discrete Hessian of all the basis functions with support on the current cell or on one of its neighbors.
 compute_discrete_hessians(cell,
 discrete_hessians,
 discrete_hessians_neigh);
Â
First, we compute and add the interactions of the degrees of freedom of the current cell.
Next, we compute and add the interactions of the degrees of freedom of the current cell with those of its neighbors. Note that the interactions of the degrees of freedom of a neighbor with those of the same neighbor are included here.
 for (unsignedint face_no = 0; face_no < cell->n_faces(); ++face_no)
There is nothing to be done if boundary face (the liftings of the Dirichlet BCs are accounted for in the assembly of the RHS; in fact, nothing to be done in this program since we prescribe homogeneous BCs).
We now compute and add the interactions of the degrees of freedom of a neighboring cells with those of another neighboring cell (this is where we need the extended sparsity pattern).
 for (unsignedint face_no = 0; face_no < cell->n_faces() - 1; ++face_no)
This function assemble the right-hand side of the system. Since we consider homogeneous Dirichlet boundary conditions, imposed weakly in the bilinear form using the Nitsche approach, it only involves the contribution of the forcing term .
To solve the linear system , we proceed as in step-74 and use a direct method. We could as well use an iterative method, for instance the conjugate gradient method as in step-3.
This function computes the discrete , and norms of the error , where is the exact solution and is the approximate solution. See the introduction for the definition of the norms.
As already mentioned above, this function is used to assemble the (local) mass matrices needed for the computations of the lifting terms. We reiterate that only the basis functions with support on the current cell are considered.
 template <int dim>
 void BiLaplacianLDGLift<dim>::assemble_local_matrix(
This function is the main novelty of this program. It computes the discrete Hessian for all the basis functions of supported on the current cell and those supported on a neighboring cell. The first argument indicates the current cell (referring to the global DoFHandler object), while the other two arguments are output variables that are filled by this function.
In the following, we need to evaluate finite element shape functions for the fe_lift finite element on the current cell. Like for example in step-61, this "lift" space is defined on every cell individually; as a consequence, there is no global DoFHandler associated with this because we simply have no need for such a DoFHandler. That leaves the question of what we should initialize the FEValues and FEFaceValues objects with when we ask them to evaluate shape functions of fe_lift on a concrete cell. If we simply provide the first argument to this function, cell, to FEValues::reinit(), we will receive an error message that the given cell belongs to a DoFHandler that has a different finite element associated with it than the fe_lift object we want to evaluate. Fortunately, there is a relatively easy solution: We can call FEValues::reinit() with a cell that points into a triangulation – the same cell, but not associated with a DoFHandler, and consequently no finite element space. In that case, FEValues::reinit() will skip the check that would otherwise lead to an error message. All we have to do is to convert the DoFHandler cell iterator into a Triangulation cell iterator; see the first couple of lines of the function below to see how this can be done.
 template <int dim>
 void BiLaplacianLDGLift<dim>::compute_discrete_hessians(
The information we need from the basis functions of : fe_values is needed to add the broken Hessian part of the discrete Hessian, while fe_face and fe_face_neighbor are used to compute the right-hand sides for the local problems.
 constunsignedint n_dofs = fe_values.dofs_per_cell;
Â
The information needed from the basis functions of the finite element space for the lifting terms: fe_values_lift is used for the (local) mass matrix (see in the introduction), while fe_face_lift is used to compute the right-hand sides (see for ).
We start by assembling the (local) mass matrix used for the computation of the lifting terms and .
 assemble_local_matrix(fe_values_lift, n_q_points, local_matrix_lift);
Â
 for (unsignedint i = 0; i < n_dofs; ++i)
 for (unsignedint q = 0; q < n_q_points; ++q)
 {
 discrete_hessians[i][q] = 0;
Â
 for (unsignedint face_no = 0;
 face_no < discrete_hessians_neigh.size();
 ++face_no)
 {
 discrete_hessians_neigh[face_no][i][q] = 0;
 }
 }
Â
In this loop, we compute the discrete Hessian at each quadrature point of cell for each basis function supported on cell, namely we fill-in the variable discrete_hessians[i][q]. For the lifting terms, we need to add the contribution of all the faces of cell.
 for (unsignedint i = 0; i < n_dofs; ++i)
 {
 coeffs_re = 0;
 coeffs_be = 0;
Â
 for (unsignedint face_no = 0; face_no < cell->n_faces(); ++face_no)
Recall that by convention, the average of a function across a boundary face reduces to the trace of the function on the only element adjacent to , namely there is no factor . We distinguish between the two cases (the current face lies in the interior or on the boundary of the domain) using the variable factor_avg.
 factor_avg = 0.5;
 if (at_boundary)
 {
 factor_avg = 1.0;
 }
Â
 fe_face.reinit(cell, face_no);
 fe_face_lift.reinit(cell_lift, face_no);
Â
 local_rhs_re = 0;
 for (unsignedint q = 0; q < n_q_points_face; ++q)
In this loop, we compute the discrete Hessian at each quadrature point of cell for each basis function supported on a neighboring neighbor_cell of cell, namely we fill-in the variable discrete_hessians_neigh[face_no][i][q]. For the lifting terms, we only need to add the contribution of the face adjacent to cell and neighbor_cell.
 for (unsignedint face_no = 0; face_no < cell->n_faces(); ++face_no)
 coeffs_re[m] * fe_values_lift[tau_ext].value(m, q);
 }
Â
 for (unsignedint m = 0; m < n_dofs_lift; ++m)
 {
 discrete_hessians_neigh[face_no][i][q] +=
 coeffs_be[m] * fe_values_lift[tau_ext].value(m, q);
 }
 }
Â
 } // for dof i
 } // boundary check
 } // for face
 }
Â
Â
Â
BiLaplacianLDGLift::run
 template <int dim>
 void BiLaplacianLDGLift<dim>::run()
 {
 make_grid();
Â
 setup_system();
 assemble_system();
Â
 solve();
Â
 compute_errors();
 output_results();
 }
Â
 } // namespace Step82
Â
Â
Â
The main function
This is the main function. We define here the number of mesh refinements, the polynomial degree for the two finite element spaces (for the solution and the two liftings) and the two penalty coefficients. We can also change the dimension to run the code in 3d.
 int main()
 {
 try
 {
 constunsignedint n_ref = 3; // number of mesh refinements
Â
 constunsignedint degree =
 2; // FE degree for u_h and the two lifting terms
Â
 constdouble penalty_grad =
 1.0; // penalty coefficient for the jump of the gradients
 constdouble penalty_val =
 1.0; // penalty coefficient for the jump of the values
Â
 Step82::BiLaplacianLDGLift<2> problem(n_ref,
 degree,
 penalty_grad,
 penalty_val);
Â
 problem.run();
 }
 catch (std::exception &exc)
 {
 std::cerr << std::endl
 << std::endl
 << "----------------------------------------------------"
 << std::endl;
 std::cerr << "Exception on processing: " << std::endl
 << exc.what() << std::endl
 << "Aborting!" << std::endl
 << "----------------------------------------------------"
 << std::endl;
 return 1;
 }
 catch (...)
 {
 std::cerr << std::endl
 << std::endl
 << "----------------------------------------------------"
 << std::endl;
 std::cerr << "Unknown exception!" << std::endl
 << "Aborting!" << std::endl
 << "----------------------------------------------------"
 << std::endl;
 return 1;
 }
Â
 return 0;
 }
Results
When running the program, the sparsity pattern is written to an svg file, the solution is written to a vtk file, and some results are printed to the console. With the current setup, the output should read
Number of active cells: 64
Number of degrees of freedom: 576
Assembling the system.............
Done.
DG H2 norm of the error: 0.0151063
DG H1 norm of the error: 0.000399747
L2 norm of the error: 5.33856e-05
This corresponds to the bi-Laplacian problem with the manufactured solution mentioned above for , 3 refinements of the mesh, degree , and for the penalty coefficients. By changing the number of refinements, we get the following results:
n_ref
n_cells
n_dofs
error H2
rate
error H1
rate
error L2
rate
1
4
36
5.651e-02
–
3.366e-03
–
3.473e-04
–
2
16
144
3.095e-02
0.87
1.284e-03
1.39
1.369e-04
1.34
3
64
576
1.511e-02
1.03
3.997e-04
1.68
5.339e-05
1.36
4
256
2304
7.353e-03
1.04
1.129e-04
1.82
1.691e-05
1.66
5
1024
9216
3.609e-03
1.03
3.024e-05
1.90
4.789e-06
1.82
6
4096
36864
1.785e-03
1.02
7.850e-06
1.95
1.277e-06
1.91
This matches the expected optimal convergence rates for the and norms, but is sub-optimal for the norm. Incidentally, this also matches the results seen in step-47 when using polynomial degree .
Indeed, just like in step-47, we can regain the optimal convergence order if we set the polynomial degree of the finite elements to or higher. Here are the numbers for :
n_ref
n_cells
n_dofs
error H2
rate
error H1
rate
error L2
rate
1
4
36
1.451e-02
–
5.494e-04
–
3.035e-05
–
2
16
144
3.565e-03
2.02
6.870e-05
3.00
2.091e-06
3.86
3
64
576
8.891e-04
2.00
8.584e-06
3.00
1.352e-07
3.95
4
256
2304
2.223e-04
2.00
1.073e-06
3.00
8.594e-09
3.98
5
1024
9216
5.560e-05
2.00
1.341e-07
3.00
5.418e-10
3.99
6
4096
36864
1.390e-05
2.00
1.676e-08
3.00
3.245e-11
4.06
Possible extensions
The code can be easily adapted to deal with the following cases:
Non-homogeneous Dirichlet boundary conditions on (part of) the boundary of .
Hanging-nodes (proceed as in step-14 to not visit a sub-face twice when computing the lifting terms in compute_discrete_hessians and the penalty terms in assemble_matrix).
LDG method for the Poisson problem (use the discrete gradient consisting of the broken gradient and the lifting of the jump of ).
We give below additional details for the first of these points.
Non-homogeneous Dirichlet boundary conditions
If we prescribe non-homogeneous Dirichlet conditions, say
then the right-hand side of the linear system needs to be modified as follows
Note that for any given index , many of the terms are zero. Indeed, for we have , where is the element for which . Therefore, the liftings and contribute to only if has support on or a neighbor of . In other words, when integrating on a cell , we need to add
to for the indices such that has support on and
to for the indices such that has support on a neighbor of .
Note
Note that we can easily consider the case where Dirichlet boundary conditions are imposed only on a subset . In this case, we simply need to replace by consisting of the faces belonging to . This also affects the matrix (simply replace by ).