# restart
    # read the starting time from file
    f=open('./output/time.txt','r')
    t_0=int(f.read())
    f.close()
    # read the array from file
    y = np.loadtxt('./output/y_t.txt')

print "start time evolution..."
t_start = time.time()
n_species = chemistry_obj.gas.n_species
for j in range(T_step):
    # diffusion for dt/2
    y = diffusion_solver.advance(y,n_species,dt/2.)
    # chemical evolution for dt
    chemistry_obj.advance(y,dt)
    # diffusion for another dt/2
    y = diffusion_solver.advance(y,n_species,dt/2.)
    print j
    # record data for every 100 time steps and the end of the simulation
    if (j+1)%data_frequency == 0 or j+1 == T_step:
        # save data for plot or restart
        t = t_0 + (j+1)*dt
        # save the time to file
        f = open('./output/time.txt', 'w')
        f.write(str(t))
        f.close()
        np.savetxt('./output/y_t.txt',y)
        print "snapshot saved at t =",t

print "end of time evolution"