Modified code to output reaction diffusion solutions at the appropriate moment in control loop