How to setting Dirichlet boundary condition by node index?

You can have a look at: Boundary conditions on edges or nodes - #6 by dokken