import processing.readwritedatafiles as readwritedatafiles # Read data file fname = "Data_final.pkl" solver = readwritedatafiles.read_data_file(fname) # Unpack mesh = solver.mesh physics = solver.physics # Compute L2 error solver.time = 0. # reset time due to periodicity post.get_error(mesh, physics, solver, "Scalar") ''' Plot ''' # Scalar contour plot.prepare_plot(linewidth=0.5) plot.plot_solution(mesh, physics, solver, "Scalar", plot_numerical=True, create_new_figure=True, include_mesh=True, regular_2D=True, equal_AR=False, show_elem_IDs=True) # Save figure plot.save_figure(file_name='gaussian', file_type='pdf', crop_level=2) plot.show_plot()
"Scalar", plot_numerical=True, plot_exact=False, plot_IC=False, create_new_figure=True, fmt='bo', legend_label="DG", equidistant_pts=True) # Exact solution plot.plot_solution(mesh, physics, solver, "Scalar", plot_exact=True, plot_numerical=False, create_new_figure=False, fmt='k-') # Initial condition plot.plot_solution(mesh, physics, solver, "Scalar", plot_IC=True, plot_numerical=False, create_new_figure=False, fmt='k--') # Save figure plot.save_figure(file_name='dampingsinewave', file_type='pdf', crop_level=2) plot.show_plot()
solver, "Scalar", plot_numerical=True, plot_exact=False, plot_IC=False, create_new_figure=True, fmt='bo', legend_label="DG") # Exact solution plot.plot_solution(mesh, physics, solver, "Scalar", plot_exact=True, plot_numerical=False, create_new_figure=False, fmt='k-') # Initial condition plot.plot_solution(mesh, physics, solver, "Scalar", plot_IC=True, plot_numerical=False, create_new_figure=False, fmt='k--') # Save figure plot.save_figure(file_name='scalar', file_type='pdf', crop_level=2) plot.show_plot()
plot.plot_solution(mesh, physics, solver, "Density", plot_numerical=True, plot_exact=False, plot_IC=False, create_new_figure=True, fmt='bo', legend_label="DG", include_mesh=False, regular_2D=True, show_elem_IDs=False, levels=levels) plot.save_figure(file_name='contour', file_type='pdf') ### Line probe (y = 1.7875) ### plot.prepare_plot(close_all=False, linewidth=1.5) # Parameters xy1 = [0., 1.7875] xy2 = [2., 1.7875] # DG solution plot.plot_line_probe(mesh, physics, solver, "Density", xy1=xy1, xy2=xy2, plot_numerical=True,
solver, "Scalar", plot_numerical=True, plot_exact=False, plot_IC=False, create_new_figure=True, fmt='bo', legend_label="DG") # Exact solution plot.plot_solution(mesh, physics, solver, "Scalar", plot_exact=True, plot_numerical=False, create_new_figure=False, fmt='k-') # Initial condition plot.plot_solution(mesh, physics, solver, "Scalar", plot_IC=True, plot_numerical=False, create_new_figure=False, fmt='k--') # Save figure plot.save_figure(file_name='constant_advection', file_type='pdf', crop_level=2) plot.show_plot()
import numpy as np import processing.post as post import processing.plot as plot import processing.readwritedatafiles as readwritedatafiles # Read data file fname = "Data_final.pkl" solver = readwritedatafiles.read_data_file(fname) # Unpack mesh = solver.mesh physics = solver.physics # Compute L2 error post.get_error(mesh, physics, solver, "Pressure", normalize_by_volume=False) ''' Plot ''' # Pressure contour plot.prepare_plot(linewidth=0.5) plot.plot_solution(mesh, physics, solver, "Pressure", plot_numerical=True, plot_exact=False, plot_IC=False, create_new_figure=True, fmt='bo', legend_label="DG", include_mesh=False, regular_2D=True, equal_AR=False) # Save figure plot.save_figure(file_name='Pressure', file_type='pdf', crop_level=2) plot.show_plot()
# Unpack mesh = solver.mesh physics = solver.physics # Compute L2 error post.get_error(mesh, physics, solver, "Density", normalize_by_volume=False) ''' Plot ''' # Density contour plot.prepare_plot(linewidth=0.5) plot.plot_solution(mesh, physics, solver, "Density", plot_numerical=True, plot_exact=False, plot_IC=False, create_new_figure=True, fmt='bo', legend_label="DG", include_mesh=False, regular_2D=True, equal_AR=False, level=None) # Save figure plot.save_figure(file_name='Density', file_type='pdf', crop_level=2) # Pressure contour plot.prepare_plot(close_all=False, linewidth=0.5) plot.plot_solution(mesh, physics, solver, "Pressure", plot_numerical=True, plot_exact=False, plot_IC=False, create_new_figure=True, fmt='bo', legend_label="DG", include_mesh=False, regular_2D=True, equal_AR=False, level=None) # Save figure plot.save_figure(file_name='Pressure', file_type='pdf', crop_level=2) # x-velocity contour plot.prepare_plot(close_all=False, linewidth=0.5) plot.plot_solution(mesh, physics, solver, "XVelocity", plot_numerical=True, plot_exact=False, plot_IC=False, create_new_figure=True, fmt='bo', legend_label="DG", include_mesh=False, regular_2D=True,
solver, "Energy", plot_numerical=True, plot_exact=False, plot_IC=False, create_new_figure=True, fmt='bo', legend_label="DG") # Exact solution plot.plot_solution(mesh, physics, solver, "Energy", plot_exact=True, plot_numerical=False, create_new_figure=False, fmt='k-') # Initial condition plot.plot_solution(mesh, physics, solver, "Energy", plot_IC=True, plot_numerical=False, create_new_figure=False, fmt='k--') # Save figure plot.save_figure(file_name='energy', file_type='pdf', crop_level=2) plot.show_plot()
fmt='k-.', legend_label="Exact") # DG solution plot.plot_solution(mesh, physics, solver, "Density", plot_numerical=False, plot_exact=False, plot_IC=False, plot_average=True, create_new_figure=False, fmt='bo', legend_label="Numerical") plot.save_figure(file_name='Density', file_type='png') ### Pressure # Exact solution plot.plot_solution(mesh, physics, solver, "Pressure", plot_numerical=False, plot_exact=True, plot_IC=False, create_new_figure=True, fmt='k-.', legend_label="Exact") # DG solution plot.plot_solution(mesh,
''' Plot dispersion relation ''' plt.figure() for i in range(norders): plt.plot(Lplot / np.pi, Omega_r_phys_all[:, i] / nb_all[i], '--', label="$p = %d$" % (orders[i])) # Exact relation plt.plot(np.array([Lplot[0], Lplot[-1]]) / np.pi, np.array([Lplot[0], Lplot[-1]]), 'k:', label="Exact") plt.xlabel("$\\Lambda/\\pi$") plt.ylabel("$\\Omega_r/N_p$") plt.legend(loc="best") plot.save_figure(file_name='Dispersion', file_type='pdf', crop_level=2) ''' Plot dissipation relation ''' plt.figure() for i in range(norders): plt.plot(Lplot[:-1] / np.pi, Omega_i_phys_all[:-1, i] / nb_all[i], '--', label="$p = %d$" % (orders[i])) # Exact relation plt.plot(np.array([Lplot[0], Lplot[-1]]) / np.pi, np.array([0., 0.]), 'k:', label="Exact") plt.xlabel("$\\Lambda/\\pi$") plt.ylabel("$\\Omega_i/N_p$") plt.legend(loc="best")