47 Return (time stamp, grid cells per axis, max error, rms error) of the last
50 snapshots = read_snapshots(
51 os.path.join(run_directory,
"solution-EulerFD4Smooth.peano-patch-file")
53 time_stamp, files = snapshots[-1]
56 number_of_grid_cells = 0
57 min_grid_cell_size = math.inf
58 for file_name
in files:
61 for attributes
in parser.unknown_attributes.values():
63 for patch
in attributes.cell_data:
64 offset, size =
snap(patch.offset, patch.size)
66 min_grid_cell_size = min(min_grid_cell_size, h[0])
67 shape = [dofs] * attributes.dimensions + [attributes.unknowns]
69 density = patch.values.reshape(shape)[..., 0]
70 x = offset[0] + (np.arange(dofs) + 0.5) * h[0]
72 if not np.all(np.isfinite(error)):
73 return time_stamp,
None, math.nan, math.nan
74 max_error = max(max_error, float(np.max(error)))
75 squared_error += float(np.sum(error * error))
76 number_of_grid_cells += error.size
79 round(DOMAIN_WIDTH / min_grid_cell_size),
81 math.sqrt(squared_error / number_of_grid_cells),