Note that this only works for small problems, see Conversion from array to PETSc and from PETSc to array - #4 by dokken