def run_sim(): """ Run the simulation and write the output files. This calls :func:`simrun.run` to actually perform the simulation. The results are then written to output files. """ sim_info["start_time"] = datetime.datetime.utcnow() v_vec, t_vec = simrun.run(sim_var) sim_info["end_time"] = datetime.datetime.utcnow() sim_info["sim_time"] = sim_info["end_time"] - sim_info["start_time"] write_output(v_vec, t_vec)
''' Created on 28 dec 2010 @author: gustaf ''' import pylab as PL import simrun import time #=============================================================================== D = simrun.run() x = simrun.getxvals() PL.figure(1) labels = [] i = 0 for d in D: times = simrun.TMAX_D a = simrun.diff_analyt(x, times[i]) PL.plot(x,d, 'o') PL.plot(x,a) i += 1 PL.legend() PL.title("Diffusion Equation, different simulation times. Dots - Numerical. Lines - Analytical") PL.xlabel('x') PL.ylabel('PSI') PL.show() #=============================================================================== #------------------------------------------------------