Skip to content
Snippets Groups Projects
Commit 97e78f50 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

cleans up error plot

parent 4d23c45f
Branches
Tags
1 merge request!36Feature/particle integration test
Pipeline #119587 passed
......@@ -15,8 +15,9 @@ def main():
data_file = h5py.File(c.simname + '_particles.h5', 'r')
vv = data_file['particle_o2_n1_m1_f1/velocity/0'][()]
print(np.min(vv), np.max(vv))
# to figure out reasonable timestep to satisfy "particle shall not move more than one grid cell"
#vv = data_file['particle_o2_n1_m1_f1/velocity/0'][()]
#print(np.min(vv), np.max(vv))
f = plt.figure(figsize = (9, 9))
......@@ -43,20 +44,36 @@ def main():
for factor in [1, 2, 4]:
xx1 = data_file['particle_o{0}_n{1}_m{2}_f{3}/position/{4}'.format(oo, n, m, factor, factor*8)][()]
xx2 = data_file['particle_o{0}_n{1}_m{2}_f{3}/position/{4}'.format(oo, n, m, factor*2, factor*16)][()]
err_list.append(np.mean(np.abs(xx2 - xx1)))
diff = np.sqrt(np.sum((xx2 - xx1)**2, axis = -1))
err_list.append(np.mean(diff))
a.plot(dtlist,
err_list,
label = 'o{0}_n{1}_m{2}'.format(oo, n, m),
dashes = (oo, oo),
marker = '.')
a.plot(dtlist,
np.array(dtlist)**2 * (1e-2),
color = (0, 0, 0),
dashes = (2, 2))
a.legend(loc = 'best')
dashes = (1, 1),
label = '$\\propto \\Delta t^2$')
a.plot(dtlist,
np.array(dtlist)**3 * (1e-2),
color = (0, 0, 0),
dashes = (2, 1, 2),
label = '$\\propto \\Delta t^3$')
a.plot(dtlist,
np.array(dtlist)**4 * (1e-2),
color = (0, 0, 0),
dashes = (3, 5, 3),
label = '$\\propto \\Delta t^4$')
a.legend(loc = 'upper left')
a.set_xlabel('$\\Delta t$')
a.set_ylabel('mean trajectory error')
a.set_xscale('log')
a.set_yscale('log')
f.tight_layout()
f.savefig('test_particle_integration_evdt.pdf')
f.savefig('test_particle_integration_evdt.svg')
plt.close(f)
#f = plt.figure(figsize = (6, 6))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment