Peano
Loading...
Searching...
No Matches
parseTest6.py
Go to the documentation of this file.
1import numpy as np
2from postProcess import parse_patch_file, plot_field_dg
3import matplotlib.pyplot as plt
4
5if __name__ == "__main__":
6 v_solution = parse_patch_file("DGPoisson.solution-1.peano-patch-file", "DG")
7 v_random = parse_patch_file("DGPoisson.rand-0.peano-patch-file", "DG")
8 v_solution_ini = parse_patch_file("DGPoisson.solution-0.peano-patch-file", "DG")
9
10 diff_norm = 0.0 # |v_solution - v_random|_{max}
11
12 # Iterate over all cell keys in the solution dictionary
13 # keys are coordinates of the left-bottom vertex of each cell
14 for key in v_solution.keys():
15 cell_values_solution = np.asarray(v_solution[key])
16 # Access the same key in v_random
17 cell_values_random = np.asarray(v_random[key])
18
19 # Update global max norm with local cell max norm
20 diff_norm = max( diff_norm, np.max(np.abs(cell_values_solution - cell_values_random)) )
21
22 N = 9
23 plot_field_dg(v_solution, [1/N,1/N])
24 plt.show()
25
26 print(f'|v_solution - v_random|_max = {diff_norm}')
27