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