# DUNE PDELab (2.8)

This recipe shows how to assemble a linear system of equations discretizing a PDE.

In particular, we start from a LocalOperator representing the PDE's bilinear form. Rather than defining one by ourselves, we use one already provided in PDELab. Further, we assume that a GridFunctionSpace and Constraints have already been set up.

**Definition:**convectiondiffusionfem.hh:47

This per-element LocalOperator can now be plugged into a GridOperator, which is capable of assembling a matrix for the entire domain.

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.

**Definition:**convectiondiffusionparameter.hh:325

**Definition:**interpolate.hh:177

Now, from the GridOperator, we can assemble our residual vector depending on our initial guess

and print it to console.

**Definition:**io.hh:86

Likewise, we can assemble our matrix which again depends on the initial guess

and print it as well.

**Definition:**io.hh:210

Full example code: recipe-linear-system-assembly.cc