Commit 87b94377 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Add git-SHA to the plotting scripts

parent c8e7984f
...@@ -17,7 +17,7 @@ TimeIntegration: ...@@ -17,7 +17,7 @@ TimeIntegration:
Snapshots: Snapshots:
basename: gresho # Common part of the name of output files basename: gresho # Common part of the name of output files
time_first: 0. # Time of the first output (in internal units) time_first: 0. # Time of the first output (in internal units)
delta_time: 1e-2 # Time difference between consecutive outputs (in internal units) delta_time: 1e-1 # Time difference between consecutive outputs (in internal units)
# Parameters governing the conserved quantities statistics # Parameters governing the conserved quantities statistics
Statistics: Statistics:
......
...@@ -41,9 +41,9 @@ params = {'axes.labelsize': 10, ...@@ -41,9 +41,9 @@ params = {'axes.labelsize': 10,
'xtick.labelsize': 10, 'xtick.labelsize': 10,
'ytick.labelsize': 10, 'ytick.labelsize': 10,
'text.usetex': True, 'text.usetex': True,
'figure.figsize' : (6.45,6.45), 'figure.figsize' : (9.90,6.45),
'figure.subplot.left' : 0.07, 'figure.subplot.left' : 0.045,
'figure.subplot.right' : 0.985, 'figure.subplot.right' : 0.99,
'figure.subplot.bottom' : 0.05, 'figure.subplot.bottom' : 0.05,
'figure.subplot.top' : 0.99, 'figure.subplot.top' : 0.99,
'figure.subplot.wspace' : 0.15, 'figure.subplot.wspace' : 0.15,
...@@ -87,6 +87,9 @@ boxSize = sim["/Header"].attrs["BoxSize"][0] ...@@ -87,6 +87,9 @@ boxSize = sim["/Header"].attrs["BoxSize"][0]
time = sim["/Header"].attrs["Time"][0] time = sim["/Header"].attrs["Time"][0]
scheme = sim["/HydroScheme"].attrs["Scheme"] scheme = sim["/HydroScheme"].attrs["Scheme"]
kernel = sim["/HydroScheme"].attrs["Kernel function"] kernel = sim["/HydroScheme"].attrs["Kernel function"]
neighbours = sim["/HydroScheme"].attrs["Kernel target N_ngb"]
eta = sim["/HydroScheme"].attrs["Kernel eta"]
git = sim["Code"].attrs["Git Revision"]
pos = sim["/PartType0/Coordinates"][:,:] pos = sim["/PartType0/Coordinates"][:,:]
x = pos[:,0] - boxSize / 2 x = pos[:,0] - boxSize / 2
...@@ -96,60 +99,100 @@ r = sqrt(x**2 + y**2) ...@@ -96,60 +99,100 @@ r = sqrt(x**2 + y**2)
v_r = (x * vel[:,0] + y * vel[:,1]) / r v_r = (x * vel[:,0] + y * vel[:,1]) / r
v_phi = (-y * vel[:,0] + x * vel[:,1]) / r v_phi = (-y * vel[:,0] + x * vel[:,1]) / r
v_norm = sqrt(vel[:,0]**2 + vel[:,1]**2) v_norm = sqrt(vel[:,0]**2 + vel[:,1]**2)
rho = sim["/PartType0/Density"][:]
u = sim["/PartType0/InternalEnergy"][:] u = sim["/PartType0/InternalEnergy"][:]
S = sim["/PartType0/Entropy"][:]
P = sim["/PartType0/Pressure"][:]
# Plot the interesting quantities # Plot the interesting quantities
figure() figure()
# Internal energy profile --------------------------------
subplot(221)
plot(r, u, 'x', color='r') # Azimuthal velocity profile -----------------------------
plot(solution_r, solution_u, '--', color='k', alpha=0.8, lw=1.2) subplot(231)
plot(r, v_phi, '.', color='r', ms=0.5)
plot(solution_r, solution_v_phi, '--', color='k', alpha=0.8, lw=1.2)
plot([0.2, 0.2], [-100, 100], ':', color='k', alpha=0.4, lw=1.2) plot([0.2, 0.2], [-100, 100], ':', color='k', alpha=0.4, lw=1.2)
plot([0.4, 0.4], [-100, 100], ':', color='k', alpha=0.4, lw=1.2) plot([0.4, 0.4], [-100, 100], ':', color='k', alpha=0.4, lw=1.2)
xlabel("${\\rm{Radius}}~r$", labelpad=0) xlabel("${\\rm{Radius}}~r$", labelpad=0)
ylabel("${\\rm{Internal~Energy}}~u$", labelpad=0) ylabel("${\\rm{Azimuthal~velocity}}~v_\\phi$", labelpad=0)
text(0.02, 8.97, "%s"%scheme, fontsize=9, backgroundcolor="w")
text(0.02, 8.82, "%s"%kernel, fontsize=9, backgroundcolor="w")
xlim(0,R_max) xlim(0,R_max)
ylim(7.3, 9.1) ylim(-0.1, 1.2)
# Azimuthal velocity profile ----------------------------- # Radial density profile --------------------------------
subplot(222) subplot(232)
plot(r, v_phi, 'x', color='r') plot(r, rho, '.', color='r', ms=0.5)
plot(solution_r, solution_v_phi, '--', color='k', alpha=0.8, lw=1.2) plot(solution_r, solution_rho, '--', color='k', alpha=0.8, lw=1.2)
plot([0.2, 0.2], [-100, 100], ':', color='k', alpha=0.4, lw=1.2) plot([0.2, 0.2], [-100, 100], ':', color='k', alpha=0.4, lw=1.2)
plot([0.4, 0.4], [-100, 100], ':', color='k', alpha=0.4, lw=1.2) plot([0.4, 0.4], [-100, 100], ':', color='k', alpha=0.4, lw=1.2)
xlabel("${\\rm{Radius}}~r$", labelpad=0) xlabel("${\\rm{Radius}}~r$", labelpad=0)
ylabel("${\\rm{Azimuthal~velocity}}~v_\\phi$", labelpad=0) ylabel("${\\rm{Density}}~\\rho$", labelpad=0)
xlim(0,R_max) xlim(0,R_max)
ylim(-0.1, 1.2) ylim(rho0-0.3, rho0 + 0.3)
text(0.75, 1, "$t=%.3f$"%(time), ha="right", va="bottom") #yticks([-0.2, -0.1, 0., 0.1, 0.2])
# Radial velocity profile -------------------------------- # Radial pressure profile --------------------------------
subplot(223) subplot(233)
plot(r, v_r, 'x', color='r', label="$\\texttt{SWIFT}$") plot(r, P, '.', color='r', ms=0.5)
plot(solution_r, solution_v_r, '--', color='k', alpha=0.8, lw=1.2, label="$\\rm{Solution}$") plot(solution_r, solution_P, '--', color='k', alpha=0.8, lw=1.2)
plot([0.2, 0.2], [-100, 100], ':', color='k', alpha=0.4, lw=1.2) plot([0.2, 0.2], [-100, 100], ':', color='k', alpha=0.4, lw=1.2)
plot([0.4, 0.4], [-100, 100], ':', color='k', alpha=0.4, lw=1.2) plot([0.4, 0.4], [-100, 100], ':', color='k', alpha=0.4, lw=1.2)
xlabel("${\\rm{Radius}}~r$", labelpad=0) xlabel("${\\rm{Radius}}~r$", labelpad=0)
ylabel("${\\rm{Radial~velocity}}~v_r$", labelpad=-5) ylabel("${\\rm{Pressure}}~P$", labelpad=0)
legend(loc="upper right", fontsize=10, frameon=False, numpoints=1, handletextpad=0.1, handlelength=1.2) xlim(0, R_max)
ylim(4.9 + P0, P0 + 6.1)
# Internal energy profile --------------------------------
subplot(234)
plot(r, u, '.', color='r', ms=0.5)
plot(solution_r, solution_u, '--', color='k', alpha=0.8, lw=1.2)
plot([0.2, 0.2], [-100, 100], ':', color='k', alpha=0.4, lw=1.2)
plot([0.4, 0.4], [-100, 100], ':', color='k', alpha=0.4, lw=1.2)
xlabel("${\\rm{Radius}}~r$", labelpad=0)
ylabel("${\\rm{Internal~Energy}}~u$", labelpad=0)
xlim(0,R_max) xlim(0,R_max)
ylim(-0.2, 0.2) ylim(7.3, 9.1)
yticks([-0.2, -0.1, 0., 0.1, 0.2])
# Radial entropy profile --------------------------------
subplot(235)
plot(r, S, '.', color='r', ms=0.5)
plot(solution_r, solution_s, '--', color='k', alpha=0.8, lw=1.2)
plot([0.2, 0.2], [-100, 100], ':', color='k', alpha=0.4, lw=1.2)
plot([0.4, 0.4], [-100, 100], ':', color='k', alpha=0.4, lw=1.2)
xlabel("${\\rm{Radius}}~r$", labelpad=0)
ylabel("${\\rm{Entropy}}~S$", labelpad=0)
xlim(0, R_max)
ylim(4.9 + P0, P0 + 6.1)
# Image -------------------------------------------------- # Image --------------------------------------------------
subplot(224) #subplot(234)
scatter(pos[:,0], pos[:,1], c=v_norm, cmap="PuBu", edgecolors='face', s=4, vmin=0, vmax=1) #scatter(pos[:,0], pos[:,1], c=v_norm, cmap="PuBu", edgecolors='face', s=4, vmin=0, vmax=1)
text(0.95, 0.95, "$|v|$", ha="right", va="top") #text(0.95, 0.95, "$|v|$", ha="right", va="top")
xlim(0,1) #xlim(0,1)
ylim(0,1) #ylim(0,1)
xlabel("$x$", labelpad=0) #xlabel("$x$", labelpad=0)
ylabel("$y$", labelpad=0) #ylabel("$y$", labelpad=0)
savefig("greshoVortex_%03d.png"%snap) # Information -------------------------------------
subplot(236, frameon=False)
text(-0.49, 0.9, "Gresho-Chan vortex with $\\gamma=%.3f$ at $t=%.2f$"%(gas_gamma,time), fontsize=10)
text(-0.49, 0.8, "Background $\\rho_0=%.3f$"%rho0, fontsize=10)
text(-0.49, 0.7, "Background $P_0=%.3f$"%P0, fontsize=10)
plot([-0.49, 0.1], [0.62, 0.62], 'k-', lw=1)
text(-0.49, 0.5, "$\\textsc{Swift}$ %s"%git, fontsize=10)
text(-0.49, 0.4, scheme, fontsize=10)
text(-0.49, 0.3, kernel, fontsize=10)
text(-0.49, 0.2, "$%.2f$ neighbours ($\\eta=%.3f$)"%(neighbours, eta), fontsize=10)
xlim(-0.5, 0.5)
ylim(0, 1)
xticks([])
yticks([])
savefig("GreshoVortex.png", dpi=200)
...@@ -16,10 +16,4 @@ fi ...@@ -16,10 +16,4 @@ fi
../swift -s -t 1 gresho.yml ../swift -s -t 1 gresho.yml
# Plot the solution # Plot the solution
for i in {0..100} python plotSolution.py 11
do
python plotSolution.py $i
done
# Make a movie
mencoder mf://*.png -mf w=645:h=645:fps=12:type=png -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o gresho.avi
...@@ -76,6 +76,7 @@ scheme = sim["/HydroScheme"].attrs["Scheme"] ...@@ -76,6 +76,7 @@ scheme = sim["/HydroScheme"].attrs["Scheme"]
kernel = sim["/HydroScheme"].attrs["Kernel function"] kernel = sim["/HydroScheme"].attrs["Kernel function"]
neighbours = sim["/HydroScheme"].attrs["Kernel target N_ngb"] neighbours = sim["/HydroScheme"].attrs["Kernel target N_ngb"]
eta = sim["/HydroScheme"].attrs["Kernel eta"] eta = sim["/HydroScheme"].attrs["Kernel eta"]
git = sim["Code"].attrs["Git Revision"]
x = sim["/PartType0/Coordinates"][:,0] x = sim["/PartType0/Coordinates"][:,0]
v = sim["/PartType0/Velocities"][:,0] v = sim["/PartType0/Velocities"][:,0]
...@@ -226,46 +227,46 @@ figure() ...@@ -226,46 +227,46 @@ figure()
# Velocity profile -------------------------------- # Velocity profile --------------------------------
subplot(231) subplot(231)
plot(x, v, '.', color='r') plot(x, v, '.', color='r', ms=4.0)
plot(x_s, v_s, '--', color='k', alpha=0.8, lw=1.2) plot(x_s, v_s, '--', color='k', alpha=0.8, lw=1.2)
xlabel("$x$", labelpad=0) xlabel("${\\rm{Position}}~x$", labelpad=0)
ylabel("$v_x$", labelpad=0) ylabel("${\\rm{Velocity}}~v_x$", labelpad=0)
xlim(-0.5, 0.5) xlim(-0.5, 0.5)
ylim(-0.1, 0.95) ylim(-0.1, 0.95)
# Density profile -------------------------------- # Density profile --------------------------------
subplot(232) subplot(232)
plot(x, rho, '.', color='r') plot(x, rho, '.', color='r', ms=4.0)
plot(x_s, rho_s, '--', color='k', alpha=0.8, lw=1.2) plot(x_s, rho_s, '--', color='k', alpha=0.8, lw=1.2)
xlabel("$x$", labelpad=0) xlabel("${\\rm{Position}}~x$", labelpad=0)
ylabel("$\\rho$", labelpad=0) ylabel("${\\rm{Density}}~\\rho$", labelpad=0)
xlim(-0.5, 0.5) xlim(-0.5, 0.5)
ylim(0.05, 1.1) ylim(0.05, 1.1)
# Pressure profile -------------------------------- # Pressure profile --------------------------------
subplot(233) subplot(233)
plot(x, P, '.', color='r') plot(x, P, '.', color='r', ms=4.0)
plot(x_s, P_s, '--', color='k', alpha=0.8, lw=1.2) plot(x_s, P_s, '--', color='k', alpha=0.8, lw=1.2)
xlabel("$x$", labelpad=0) xlabel("${\\rm{Position}}~x$", labelpad=0)
ylabel("$P$", labelpad=0) ylabel("${\\rm{Pressure}}~P$", labelpad=0)
xlim(-0.5, 0.5) xlim(-0.5, 0.5)
ylim(0.01, 1.1) ylim(0.01, 1.1)
# Internal energy profile ------------------------- # Internal energy profile -------------------------
subplot(234) subplot(234)
plot(x, u, '.', color='r') plot(x, u, '.', color='r', ms=4.0)
plot(x_s, u_s, '--', color='k', alpha=0.8, lw=1.2) plot(x_s, u_s, '--', color='k', alpha=0.8, lw=1.2)
xlabel("$x$", labelpad=0) xlabel("${\\rm{Position}}~x$", labelpad=0)
ylabel("$u$", labelpad=0) ylabel("${\\rm{Internal~Energy}}~u$", labelpad=0)
xlim(-0.5, 0.5) xlim(-0.5, 0.5)
ylim(0.8, 2.2) ylim(0.8, 2.2)
# Entropy profile --------------------------------- # Entropy profile ---------------------------------
subplot(235) subplot(235)
plot(x, S, '.', color='r') plot(x, S, '.', color='r', ms=4.0)
plot(x_s, s_s, '--', color='k', alpha=0.8, lw=1.2) plot(x_s, s_s, '--', color='k', alpha=0.8, lw=1.2)
xlabel("$x$", labelpad=0) xlabel("${\\rm{Position}}~x$", labelpad=0)
ylabel("$S$", labelpad=0) ylabel("${\\rm{Entropy}}~S$", labelpad=0)
xlim(-0.5, 0.5) xlim(-0.5, 0.5)
ylim(0.8, 3.8) ylim(0.8, 3.8)
...@@ -276,9 +277,10 @@ text(-0.49, 0.9, "Sod shock with $\\gamma=%.3f$ in 1D at $t=%.2f$"%(gas_gamma,t ...@@ -276,9 +277,10 @@ text(-0.49, 0.9, "Sod shock with $\\gamma=%.3f$ in 1D at $t=%.2f$"%(gas_gamma,t
text(-0.49, 0.8, "Left:~~ $(P_L, \\rho_L, v_L) = (%.3f, %.3f, %.3f)$"%(P_L, rho_L, v_L), fontsize=10) text(-0.49, 0.8, "Left:~~ $(P_L, \\rho_L, v_L) = (%.3f, %.3f, %.3f)$"%(P_L, rho_L, v_L), fontsize=10)
text(-0.49, 0.7, "Right: $(P_R, \\rho_R, v_R) = (%.3f, %.3f, %.3f)$"%(P_R, rho_R, v_R), fontsize=10) text(-0.49, 0.7, "Right: $(P_R, \\rho_R, v_R) = (%.3f, %.3f, %.3f)$"%(P_R, rho_R, v_R), fontsize=10)
plot([-0.49, 0.1], [0.62, 0.62], 'k-', lw=1) plot([-0.49, 0.1], [0.62, 0.62], 'k-', lw=1)
text(-0.49, 0.5, scheme, fontsize=10) text(-0.49, 0.5, "$\\textsc{Swift}$ %s"%git, fontsize=10)
text(-0.49, 0.4, kernel, fontsize=10) text(-0.49, 0.4, scheme, fontsize=10)
text(-0.49, 0.3, "$%.2f$ neighbours ($\\eta=%.3f$)"%(neighbours, eta), fontsize=10) text(-0.49, 0.3, kernel, fontsize=10)
text(-0.49, 0.2, "$%.2f$ neighbours ($\\eta=%.3f$)"%(neighbours, eta), fontsize=10)
xlim(-0.5, 0.5) xlim(-0.5, 0.5)
ylim(0, 1) ylim(0, 1)
xticks([]) xticks([])
......
...@@ -76,6 +76,7 @@ scheme = sim["/HydroScheme"].attrs["Scheme"] ...@@ -76,6 +76,7 @@ scheme = sim["/HydroScheme"].attrs["Scheme"]
kernel = sim["/HydroScheme"].attrs["Kernel function"] kernel = sim["/HydroScheme"].attrs["Kernel function"]
neighbours = sim["/HydroScheme"].attrs["Kernel target N_ngb"] neighbours = sim["/HydroScheme"].attrs["Kernel target N_ngb"]
eta = sim["/HydroScheme"].attrs["Kernel eta"] eta = sim["/HydroScheme"].attrs["Kernel eta"]
git = sim["Code"].attrs["Git Revision"]
x = sim["/PartType0/Coordinates"][:,0] x = sim["/PartType0/Coordinates"][:,0]
v = sim["/PartType0/Velocities"][:,0] v = sim["/PartType0/Velocities"][:,0]
...@@ -226,46 +227,46 @@ figure() ...@@ -226,46 +227,46 @@ figure()
# Velocity profile -------------------------------- # Velocity profile --------------------------------
subplot(231) subplot(231)
plot(x, v, '.', color='r') plot(x, v, '.', color='r', ms=0.5)
plot(x_s, v_s, '--', color='k', alpha=0.8, lw=1.2) plot(x_s, v_s, '--', color='k', alpha=0.8, lw=1.2)
xlabel("$x$", labelpad=0) xlabel("${\\rm{Position}}~x$", labelpad=0)
ylabel("$v_x$", labelpad=0) ylabel("${\\rm{Velocity}}~v_x$", labelpad=0)
xlim(-0.5, 0.5) xlim(-0.5, 0.5)
ylim(-0.1, 0.95) ylim(-0.1, 0.95)
# Density profile -------------------------------- # Density profile --------------------------------
subplot(232) subplot(232)
plot(x, rho, '.', color='r') plot(x, rho, '.', color='r', ms=0.5)
plot(x_s, rho_s, '--', color='k', alpha=0.8, lw=1.2) plot(x_s, rho_s, '--', color='k', alpha=0.8, lw=1.2)
xlabel("$x$", labelpad=0) xlabel("${\\rm{Position}}~x$", labelpad=0)
ylabel("$\\rho$", labelpad=0) ylabel("${\\rm{Density}}~\\rho$", labelpad=0)
xlim(-0.5, 0.5) xlim(-0.5, 0.5)
ylim(0.05, 1.1) ylim(0.05, 1.1)
# Pressure profile -------------------------------- # Pressure profile --------------------------------
subplot(233) subplot(233)
plot(x, P, '.', color='r') plot(x, P, '.', color='r', ms=0.5)
plot(x_s, P_s, '--', color='k', alpha=0.8, lw=1.2) plot(x_s, P_s, '--', color='k', alpha=0.8, lw=1.2)
xlabel("$x$", labelpad=0) xlabel("${\\rm{Position}}~x$", labelpad=0)
ylabel("$P$", labelpad=0) ylabel("${\\rm{Pressure}}~P$", labelpad=0)
xlim(-0.5, 0.5) xlim(-0.5, 0.5)
ylim(0.01, 1.1) ylim(0.01, 1.1)
# Internal energy profile ------------------------- # Internal energy profile -------------------------
subplot(234) subplot(234)
plot(x, u, '.', color='r') plot(x, u, '.', color='r', ms=0.5)
plot(x_s, u_s, '--', color='k', alpha=0.8, lw=1.2) plot(x_s, u_s, '--', color='k', alpha=0.8, lw=1.2)
xlabel("$x$", labelpad=0) xlabel("${\\rm{Position}}~x$", labelpad=0)
ylabel("$u$", labelpad=0) ylabel("${\\rm{Internal~Energy}}~u$", labelpad=0)
xlim(-0.5, 0.5) xlim(-0.5, 0.5)
ylim(0.8, 2.2) ylim(0.8, 2.2)
# Entropy profile --------------------------------- # Entropy profile ---------------------------------
subplot(235) subplot(235)
plot(x, S, '.', color='r') plot(x, S, '.', color='r', ms=0.5)
plot(x_s, s_s, '--', color='k', alpha=0.8, lw=1.2) plot(x_s, s_s, '--', color='k', alpha=0.8, lw=1.2)
xlabel("$x$", labelpad=0) xlabel("${\\rm{Position}}~x$", labelpad=0)
ylabel("$S$", labelpad=0) ylabel("${\\rm{Entropy}}~S$", labelpad=0)
xlim(-0.5, 0.5) xlim(-0.5, 0.5)
ylim(0.8, 3.8) ylim(0.8, 3.8)
...@@ -276,9 +277,10 @@ text(-0.49, 0.9, "Sod shock with $\\gamma=%.3f$ in 2D at $t=%.2f$"%(gas_gamma,t ...@@ -276,9 +277,10 @@ text(-0.49, 0.9, "Sod shock with $\\gamma=%.3f$ in 2D at $t=%.2f$"%(gas_gamma,t
text(-0.49, 0.8, "Left:~~ $(P_L, \\rho_L, v_L) = (%.3f, %.3f, %.3f)$"%(P_L, rho_L, v_L), fontsize=10) text(-0.49, 0.8, "Left:~~ $(P_L, \\rho_L, v_L) = (%.3f, %.3f, %.3f)$"%(P_L, rho_L, v_L), fontsize=10)
text(-0.49, 0.7, "Right: $(P_R, \\rho_R, v_R) = (%.3f, %.3f, %.3f)$"%(P_R, rho_R, v_R), fontsize=10) text(-0.49, 0.7, "Right: $(P_R, \\rho_R, v_R) = (%.3f, %.3f, %.3f)$"%(P_R, rho_R, v_R), fontsize=10)
plot([-0.49, 0.1], [0.62, 0.62], 'k-', lw=1) plot([-0.49, 0.1], [0.62, 0.62], 'k-', lw=1)
text(-0.49, 0.5, scheme, fontsize=10) text(-0.49, 0.5, "$\\textsc{Swift}$ %s"%git, fontsize=10)
text(-0.49, 0.4, kernel, fontsize=10) text(-0.49, 0.4, scheme, fontsize=10)
text(-0.49, 0.3, "$%.2f$ neighbours ($\\eta=%.3f$)"%(neighbours, eta), fontsize=10) text(-0.49, 0.3, kernel, fontsize=10)
text(-0.49, 0.2, "$%.2f$ neighbours ($\\eta=%.3f$)"%(neighbours, eta), fontsize=10)
xlim(-0.5, 0.5) xlim(-0.5, 0.5)
ylim(0, 1) ylim(0, 1)
xticks([]) xticks([])
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment