Does NGSolve automatically set test functions to zero on Dirichlet boundaries?

Hi all,
I’m working on 2D Navier–Stokes problems in NGSolve and I have a question regarding test functions.

When defining a VectorH1 space with a dirichlet="..." argument (e.g. V = VectorH1(mesh, order=2, dirichlet="wall|inlet")), does NGSolve automatically enforce that the test functions vanish on those Dirichlet boundaries?

More precisely:

  • Are test functions v∈Vv \in Vv∈V implicitly restricted such that v=0v = 0v=0 on the specified Dirichlet boundary?
  • Is this handled internally via FreeDofs or similar constraint mechanisms during assembly?

Just want to confirm this behavior when assembling weak forms, particularly for bilinear forms like

a(u,v)=∫Ω∇u⋅∇v dxa(u, v) = \int_\Omega \nabla u \cdot \nabla v , dxa(u,v)=∫Ω​∇u⋅∇vdx

where v is the test function.

Thanks!

the answer ist no.

The matrix is built for test-functions without Dirichlet-constraints

So,in NGSolve the test functions are always taken from the subspace that satisfies homogeneous Dirichlet boundary conditions.
So the stiffness matrix is built on a space where test functions vanish on the Dirichlet boundary, and hence the corresponding rows (and columns) reflect only free degrees of freedom.
Thus, when we transform \Delta u \cdot v into \nabla u : \nabla v can briefly ignore boundary term since it’s 0?

No, the stiffness matrix doesnt consider dirichlet dofs.
In solving when doing

a.mat.Inverse(fes.FreeDofs())

The inverse is only built for free dofs

So,when use this method, we still have to face the problem that if u_D is known as boundary how can I ensure (\Delta u_D,v) can be transfer into (\nabla u_D, \nabla v),since I have not find how to exacute \Delta u