dune-pdelab
2.7-git
|
Here we show how to solve a linear system of equations originating from a PDE using PDELab.
First, we set up a GridOperator as in Assembling a linear system from a PDE
Next, we set up our degree of freedom vector
and ensure it matches the Dirichlet boundary conditions at constrained degrees of freedom. In addition to specifying Dirichlet constrained degrees of freedom, it also serves as initial guess at unconstrained ones.
Now we choose the preconditioner and solver we want to use
and plug it into a StationaryLinearProblemSolver. This takes care of assembling as well as solving the system.
Finally, let's print the result to console via
There is a number of alternative solvers and preconditioners available we could use instead, for example this one:
Full example code: recipe-linear-system-solution-pdelab.cc