|
Saddle-Point
|
To compile and run the program, we cd into the build directory and type the following command:
This command will clean up the previous build and generate the makefiles, compile the program, and run the program with param.prm as the input file.
We have the following output from the program in the terminal and the error table at cycle 6:
At each cycle of refinement we print out
Then we print out a line to remind the user that the exact manufactured solution (specified in solution.cc) was written to exact.vtu, and the user can view it via a visualization program such as ParaView. We also print out the number of components of the manufactured solution, which should be 2.
We can see that the number of cells quadruples in each cycle, and the number of degrees of freedom is slightly more than two times the number of cells.
Finally, we have also printed out the error table. In the three columns headed by L2:
Similarly, the next three columns give the \(H^1\) errors. Since we are using degree-1 (linear) finite elements, we see that the \(L^2\) log error rate is roughly \(2\) and the \(H^1\) log error rate is roughly \(1\), which is what we expect from theory.
When we change the degree of the finite elements to 2 (using quadratic elements), we would expect to see the \(L^2\) log error rate to be roughly \(3\) and the \(H^1\) log error rate to be roughly \(2\). To see this in action, we go to the param.prm file and change the line
to
Then we do not need to recompile the program, which is the benefit of using a param.prm file. Instead of typing the command
we just need the latter part ./step-6 ./../param/param.prm, and we get the following output:
This matches our expectation, except at cycles 5 and 6 where the number of cells and the number of degrees of freedom become large, and our Conjugate Gradient solver might not be the best performing solver as the number of cycles increases. We would want to try a different solver such as SolverGMRES, which stands for the Restarted Preconditioned Direct Generalized Minimal Residual Method.
We notice that as the number of refinement cycles increases, the program takes quite a bit more time to run, at least on a laptop. We could potentially try different preconditioners such as
which is a simple incomplete LU decomposition without any thresholding or strengthening of the diagonal. (We need to include deal.II/lac/sparse_ilu.h in the header file for this to work.)
Users are free to specify different manufactured solutions and different right-hand sides to the program, and run to see the output. The solution and mesh in each cycle of refinement is saved as a .vtk file in the same build directory where the program is executed, and those files can be visualized using software such as ParaView.