Dolfinx mixed space dirichlet boundary

Hi, I have some doubt when looking at a demo of dolfinx. The code is:

noslip = Function(V)
with noslip.vector.localForm() as bc_local:
bc_local.set(0.0)

V is a vector finite element space. Why only set a scalar value rather than a vector?

Because you are setting values Directly in a PETScVector, Which has a different interpretation of vector values. If you want SpatialLy varying values, use the interpolation operator, see for example this test

dokken, thank you. It seems reasonable.