Diffusion behavior differs by changing constant value with .value method

You shouldn’t assemble a new matrix, but rather reassemble into your existing A which has been assigned to the KSP with the solver.setOperators(A) call.