Program "Killed" when running compute_gradient() on transient problem

Oh sorry I might not have read the example you posted completely through, it was exactly what I needed. From the tests performed it seems to works perfectly, thank you.