Esempio n. 1
0
    # 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,
                       "Pressure",
                       plot_numerical=True,
                       plot_exact=False,
                       plot_IC=False,
                       create_new_figure=False,
                       ylabel=None,
                       fmt='bo',
                       legend_label="DG",
                       ignore_legend=True)

    # plot.plot_solution(mesh, physics, solver, "Energy", plot_IC=True,
    # 		plot_numerical=False, create_new_figure=False,
    # 		fmt='k--', ignore_legend=True)

    imgs = ax.get_lines().copy()

    # Add to imgs_all
    if j == 0:
        plt.legend(loc="best")
Esempio n. 2
0
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()
Esempio n. 3
0
 solver2 = readwritedatafiles.read_data_file(fname2)
 # Unpack
 mesh = solver.mesh
 physics = solver.physics
 mesh2 = solver2.mesh
 physics2 = solver2.physics
 # plot.PlotSolution(mesh, physics, solver, "Scalar", create_new_figure=False, PlotExact=True, PlotIC=True, Label="u",
 # 		ignore_legend=True)
 plot.plot_solution(mesh,
                    physics,
                    solver,
                    "Scalar",
                    plot_numerical=True,
                    plot_exact=False,
                    plot_IC=False,
                    create_new_figure=False,
                    ylabel=None,
                    fmt='k-',
                    legend_label="DG",
                    equidistant_pts=True,
                    include_mesh=False,
                    regular_2D=False,
                    equal_AR=False,
                    ignore_legend=True)
 plot.plot_solution(mesh2,
                    physics2,
                    solver2,
                    "Scalar",
                    plot_numerical=True,
                    plot_exact=False,
                    plot_IC=False,
                    create_new_figure=False,
Esempio n. 4
0
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)

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]
Esempio n. 5
0
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",
                   plot_exact=True,
                   plot_numerical=False,
                   create_new_figure=False,
                   fmt='k-')
# Initial condition
plot.plot_solution(mesh,
Esempio n. 6
0
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()
Esempio n. 7
0
import processing.readwritedatafiles as readwritedatafiles

### Postprocess
fname = "Data_final.pkl"
solver = readwritedatafiles.read_data_file(fname)
print('Solution Final Time:', solver.time)

# Unpack
mesh = solver.mesh
physics = solver.physics

# Plot
plot.prepare_plot()
plot.plot_solution(mesh, physics, solver, "MassFraction", 
		plot_numerical=True, plot_exact=False, plot_IC=False,
		create_new_figure=True, ylabel=None, fmt='bo', 
		legend_label="DG", equidistant_pts=True, 
		include_mesh=False, regular_2D=False, equal_AR=False)

plot.plot_solution(mesh, physics, solver, "Density", 
		plot_numerical=True, plot_exact=False, plot_IC=False,
		create_new_figure=True, ylabel=None, fmt='bo', 
		legend_label="DG", equidistant_pts=True, include_mesh=False,
		regular_2D=False, equal_AR=False)

plot.plot_solution(mesh, physics, solver, "Pressure", 
		plot_numerical=True, plot_exact=False, plot_IC=False,
		create_new_figure=True, ylabel=None, fmt='bo', 
		legend_label="DG", equidistant_pts=True, include_mesh=False,
		regular_2D=False, equal_AR=False)
Esempio n. 8
0
solver = readwritedatafiles.read_data_file(fname)

# Unpack
mesh = solver.mesh
physics = solver.physics

# Compute L2 error
post.get_error(mesh, physics, solver, "Entropy", normalize_by_volume=False)
''' Plot '''
### Pressure contour ###
plot.prepare_plot(linewidth=0.5)
plot.plot_solution(mesh,
                   physics,
                   solver,
                   "Pressure",
                   plot_numerical=True,
                   create_new_figure=True,
                   include_mesh=True,
                   regular_2D=False,
                   show_elem_IDs=True)
# Save figure
plot.save_figure(file_name='Pressure', file_type='pdf', crop_level=2)

### Entropy contour ###
plot.plot_solution(mesh,
                   physics,
                   solver,
                   "Entropy",
                   plot_numerical=True,
                   create_new_figure=True,
                   include_mesh=True,
Esempio n. 9
0
# Read data file
fname = "Data_final.pkl"
solver = readwritedatafiles.read_data_file(fname)

# Unpack
mesh = solver.mesh
physics = solver.physics
''' Plot '''
### Density
plot.prepare_plot()
# Exact solution
plot.plot_solution(mesh,
                   physics,
                   solver,
                   "Density",
                   plot_numerical=False,
                   plot_exact=True,
                   plot_IC=False,
                   create_new_figure=True,
                   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',
Esempio n. 10
0
	solver = readwritedatafiles.read_data_file(fname)

	# Unpack
	mesh = solver.mesh
	physics = solver.physics

	# Plot solution
	if j == 0:
		ignore_colorbar = False
	else:
		ignore_colorbar = True

	levels = np.array([0.0, 0.025, 0.05, 0.075, 0.1, 0.25])

	plot.plot_solution(mesh, physics, solver, "Scalar", plot_numerical=True, create_new_figure=False, 
			include_mesh=True, regular_2D=True, equal_AR=False, show_elem_IDs=False, ignore_colorbar=ignore_colorbar,
			levels=levels)

	imgs = ax.collections.copy()

	# Add to imgs_all
	if j == 0:
		imgs_all.append(imgs)
	else:
		nc = len(imgs_all[j-1])
		imgs_all.append(imgs[-nc:])

	j += 1

anim = animation.ArtistAnimation(fig, imgs_all, interval=50, blit=False,
		repeat_delay=None)