Consider the elastic equation $$- \operatorname{div}(C \nabla \mathbf{u}) = \mathbf{f}$$ as presented in step-8. Here $\mathbf{u}$ is the displacement vector, let's consider the 2d case.

As you can see in the setup_system, they impose homogeneous Dirichlet boundary conditions. Then I'd expect to see that the two plots of $x$ and $y$ displacements have 0 as boundary value. However, this is not happening, and I can't understand why. You can see the x_displacement in the following Paraview screenshot. Notice the $-1.6 e-4$ value at the boundary.

enter image description here

  • $\begingroup$ How do you know that the negative value is at the boundary and not somewhere in the interior? :-) $\endgroup$ Jun 15, 2021 at 18:23
  • $\begingroup$ shame on me :-) Is there any way to print the values of the solution at the boundary, like a for loop and then std::cout? I would loop over all cells, then over all faces, I identify the ones that are on the boundary, and then I'd like to access the solution vector at the degrees of freedom of that boundary face. How can I get the dofs for a boundary face? @WolfgangBangerth $\endgroup$ Jun 16, 2021 at 7:33
  • $\begingroup$ Someone has thought of that already and wrote the DataOutFaces class :-) $\endgroup$ Jun 16, 2021 at 23:32

1 Answer 1


As mentioned by @Wolfgang Bangerth , the value may be at the interior points. However, to visualise that better in paraview, You can use a filter called "plot over line" which plots the data points over a given line, which could come very handy for these kinds of clarifications in future.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.