32 from matplotlib
import pyplot
as plt
37 errors = pd.read_csv(
"../errors_Laplace_3D_u.data", sep=
'\t')
38 errors = errors[[
"l_inf",
"l_2",
"h_1",
"DG"]]
39 errors = np.array(errors)
40 errors = errors[errors[:,0]!=
'x',:].astype(float)
46 x = np.logspace(-2, -n, num=n, base=2.0)
52 plt.loglog(x, errors[:,0],
'tab:blue', marker =
'o', linestyle =
'-', label=
'$L^\infty$ error')
53 plt.loglog(x, k*np.power(x,1)/np.power(x[0],1),
'k', linestyle =
'-.', label=
'$h^{-1}$')
54 plt.loglog(x, k*np.power(x,2)/np.power(x[0],2),
'k', linestyle =
'--', label=
'$h^{-2}$')
55 plt.loglog(x, k*np.power(x,3)/np.power(x[0],3),
'k', linestyle =
'dotted', label =
'$h^{-3}$')
57 plt.ylabel(
'$L^\infty$ error')
59 ax.set_title(
'Convergence test ($L^\infty$ error)')
67 plt.loglog(x, errors[:,1],
'tab:blue', marker =
'o', linestyle =
'-', label=
'$L^2$ error')
68 plt.loglog(x, k*np.power(x,1)/np.power(x[0],1),
'k', linestyle =
'-.', label=
'$h^{-1}$')
69 plt.loglog(x, k*np.power(x,2)/np.power(x[0],2),
'k', linestyle =
'--', label=
'$h^{-2}$')
70 plt.loglog(x, k*np.power(x,3)/np.power(x[0],3),
'k', linestyle =
'dotted', label =
'$h^{-3}$')
72 plt.ylabel(
'$L^2$ error')
74 ax.set_title(
'Convergence test ($L^2$ error)')
81 plt.loglog(x, errors[:,2],
'tab:blue', marker =
'o', linestyle =
'-', label=
'$H^1$ error')
82 plt.loglog(x, k*np.power(x,1)/np.power(x[0],1),
'k', linestyle =
'-.', label=
'$h^{-1}$')
83 plt.loglog(x, k*np.power(x,2)/np.power(x[0],2),
'k', linestyle =
'--', label=
'$h^{-2}$')
84 plt.loglog(x, k*np.power(x,3)/np.power(x[0],3),
'k', linestyle =
'dotted', label =
'$h^{-3}$')
86 plt.ylabel(
'$H^1$ error')
88 ax.set_title(
'Convergence test ($H^1$ error)')
95 plt.loglog(x, errors[:,3],
'tab:blue', marker =
'o', linestyle =
'-', label=
'$DG$ error')
96 plt.loglog(x, k*np.power(x,1)/np.power(x[0],1),
'k', linestyle =
'-.', label=
'$h^{-1}$')
97 plt.loglog(x, k*np.power(x,2)/np.power(x[0],2),
'k', linestyle =
'--', label=
'$h^{-2}$')
98 plt.loglog(x, k*np.power(x,3)/np.power(x[0],3),
'k', linestyle =
'dotted', label =
'$h^{-3}$')
100 plt.ylabel(
'$DG$ error')
102 ax.set_title(
'Convergence test ($DG$ error)')