Fundamentals: Solving the poisson equation: Why do the test functions obey v = 0 on the boundary?

Hi all,

I am trying to understand the poisson equation example from the fenics website:

We have the test and trial spaces

V = { v in H^1(Omega) : v = u_D on the boundary},
V’ = { v in H^1(Omega): v = 0 on the boundary}.

The line

bc = DirichletBC(V, u_D, boundary)

ensures that our solution u fullfills u = u_D. However I don’t understand why there isn’t any code to guarantee that the functions from the test space obey v = 0.

If you to the next page
and look at the snippet

A = assemble(A)
b = assemble(L)
bc.apply(A, b)
solve(A, u.vector(), b)

the call with bc.apply will enforce at the same time that u = u_D and v = 0 on that boundary. you do not see this snippet in the tutorial you linked because it happens internally at solve(a == L, w, bc).

I’ve written some notes about the techniques used in DOLFINx (applicable to legacy dolfin as well, where lifting is assemble_system at: Application of Dirichlet boundary conditions — FEniCS Tutorial @ Sorbonne