3import matplotlib.pyplot
as plt
4import matplotlib.animation
as animation
7from verification.postProcess
import parse_patch_file, plot_field_dg, construct_dg_function
10for i
in range(0,219,1):
11 file_name = f
"DGPoisson.solution-{i}.peano-patch-file"
12 dg_solution = parse_patch_file(file_name,
"DG")
15 exact_solution = construct_dg_function(dg_solution, [1/9,1/9])
19 diff = {key: [0] * len(value)
for key, value
in dg_solution.items()}
21 for key
in dg_solution.keys():
22 diff[key] = [ (val_sol - val_ex)
for val_sol, val_ex
in zip(dg_solution[key], exact_solution[key]) ]
23 max_norm = max( np.max(np.abs(diff[key])), max_norm )
25 MaxNorm.append(max_norm)
32plt.plot(MaxNorm, label=
'|sol_dg - sol_exact|_max', marker=
'o')
34plt.xlabel(
'DG Iterations')
35plt.ylabel(
'|sol_dg - sol_exact|_max')
39plot_field_dg(diff, [1/9,1/9])
40plt.title(f
'|dg_sov - exact_sol|_max = {max_norm}')