Questions for Solving time-dependent problem

petsc4py.PETSc._Vec_LocalForm, i.e. it is a way of accessing the local part of the vector in a context manager, see
27. Context Managers — Python Tips 0.1 documentation for notes regarding general managers.
Set(0) sets the local part of the vector to 0.

Apply lifting changes the vector to b1-= A1 g
where A1 is the matrix assembled by a1, g a vector were only having nonzero entries for the dofs. This adds contributions to all the other entries, where the bc is not set. You use set_bc to overwrite any entries with bc with the corresponding value from bcu.

Because whenever you assemble into a vector, you only assemble over cells/facets owned by the process. For dofs shared between processes, you need to add up contributions from all of them. See
for instance DOLFINx in Parallel with MPI — NewFrac FEniCSx Training