import matplotlib.animation as animation import matplotlib.pyplot as plt import processing.post as post import processing.plot as plot import processing.readwritedatafiles as readwritedatafiles plot.prepare_plot(linewidth=0.5) fig = plt.figure() ax = plt.gca() imgs_all = [] j = 0 # Loop through data files # Note: this loop only uses the first 15 frames. This is all that should be # necessary to see the dynamics of the energy being damped. for i in range(25): print(i) # Read data file fname = "Data_" + str(i) + ".pkl" solver = readwritedatafiles.read_data_file(fname) # Unpack mesh = solver.mesh physics = solver.physics # Plot solution plot.plot_solution(mesh, physics, solver,
import processing.post as post import processing.plot as plot import processing.readwritedatafiles as readwritedatafiles # Read data file fname = "Data_final.pkl" #fname = "Data_n160_P2.pkl" solver = readwritedatafiles.read_data_file(fname) # Unpack mesh = solver.mesh physics = solver.physics ''' Plot ''' levels = np.arange(0., 5., 0.5) # 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, show_elem_IDs=False, levels=levels)
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, "Scalar") ''' Plot ''' # DG solution plot.prepare_plot() plot.plot_solution(mesh, physics, 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",
# node_type = "GaussLobatto" # Basis type basis = basis_defs.LagrangeSeg(p) # Lagranage basis # basis = basis_defs.LegendreSeg(p) # Legendre basis ''' Pre-processing ''' # Solution nodes basis.get_1d_nodes = basis_tools.set_1D_node_calc(node_type) # Sample points p_plot = 100 # (p_plot + 1) points xp = basis.equidistant_nodes(p_plot) ''' Evaluate ''' basis.get_basis_val_grads(xp, get_val=True) ''' Plot ''' plot.prepare_plot(linewidth=1.) fig = plt.figure() for i in range(p + 1): if plot_all or (not plot_all and i == b): phi = basis.basis_val[:, i] plt.plot(xp, phi, label="$\\phi_{%d}$" % (i + 1)) plt.xlabel('$\\xi$') plt.ylabel('$\\phi$') plt.legend(loc="best") plt.xticks((-1., -0.5, 0., 0.5, 1.)) plt.show()