# save time taken to csv file np.savetxt(result_dir / "time_taken_yang_48x64x48.csv", np.asarray(time_taken_yang), delimiter=",") np.savetxt(result_dir / "time_taken_default_48x64x48.csv", np.asarray(time_taken_default), delimiter=",") pprint(""" ---------------------------------------- Plotting individual error data to {} ---------------------------------------- """.format(result_dir)) # save plot to result dir Visualize.plot_line(individual_error_default, fname=str(result_dir / "individual_error_default.png"), xlabel="frames", ylabel="MSE") Visualize.plot_line(individual_error_yang, fname=str(result_dir / "individual_error_yang.png"), xlabel="frames", ylabel="MSE") fake_res = (512, 512, 512) pprint(""" ---------------------------------------- Testing the speed of NN for resolution: {} ---------------------------------------- """.format(fake_res)) FakeResolution(fake_res, yang_model_path, result_dir / ("time_taken_" + str(fake_res) + ".csv"))
copyArrayToGridReal(pressure_predcition, pressure) """ ------------------------------- End of NN ------------------------------- """ # correct velocity using the predicted pressure correctVelocity(flags=flags, vel=vel, pressure=pressure) s.step() np.savetxt(result_dir / "coupling_error.csv", np.asarray(err_acc[:10]), delimiter=",") Visualize.plot_line(np.asarray(err_acc[:10]), fname=result_dir / "coupling_error.png", ylabel="Mean Square Error(MSE)", xlabel="Frames") # turn it into gif subprocess.call([ 'ffmpeg', '-i', str(result_dir / "screenshot_%04d.png"), '-y', result_dir / "simulation.gif" ]) files_in_dir = os.listdir(result_dir) for item in files_in_dir: if "screenshot" in item: os.remove(result_dir / item)