Problem to solve a Navier-Stokes problem with a Custom Newton solver in FEniCSx

As stated you should then use a function to define the bc values, as for instance done in

you can interpolate any expression into the function.