60 "halo corner": COLOUR_HALO_CORNER,
61 "shell": COLOUR_SHELL,
62 "patch interior": COLOUR_PATCH_INTERIOR,
64 figure, axes = plt.subplots(figsize=(6.5, 7.2))
65 for i
in range(-HALO, PATCH_SIZE + HALO):
66 for j
in range(-HALO, PATCH_SIZE + HALO):
71 facecolor=colours[volume_class],
72 edgecolor=COLOUR_GRID,
74 hatch=
"////" if volume_class ==
"halo corner" else None,
78 for offset, linewidth
in [(-HALO, 2.0), (0, 2.0), (HALO, 1.5)]:
79 size = PATCH_SIZE - 2 * offset
80 axes.add_patch(Rectangle((offset, offset), size, size, fill=
False, edgecolor=
"black", linewidth=linewidth))
82 interior_size = PATCH_SIZE - 2 * HALO
83 axes.text(PATCH_SIZE / 2, PATCH_SIZE / 2, f
"patch interior\n{interior_size}x{interior_size}", ha=
"center", va=
"center", fontsize=12)
85 axes.set_xlim(-margin, PATCH_SIZE + margin)
86 axes.set_ylim(-margin, PATCH_SIZE + margin)
87 axes.set_aspect(
"equal")
89 total_size = PATCH_SIZE + 2 * HALO
91 f
"Reconstructed patch, {total_size}x{total_size}:\n"
92 f
"{PATCH_SIZE}x{PATCH_SIZE} patch plus a halo of {HALO}",
97 Patch(facecolor=COLOUR_HALO, edgecolor=COLOUR_GRID, label=
"halo"),
98 Patch(facecolor=COLOUR_SHELL, edgecolor=COLOUR_GRID, label=
"shell"),
99 Patch(facecolor=COLOUR_PATCH_INTERIOR, edgecolor=COLOUR_GRID, label=
"patch interior"),
100 Patch(facecolor=COLOUR_HALO_CORNER, edgecolor=COLOUR_GRID, hatch=
"////", label=
"halo corner (not used by Rusanov)"),
107 figure.tight_layout(rect=(0, 0.1, 1, 1))
108 output = os.path.join(
109 os.path.dirname(os.path.abspath(__file__)),
"rusanov-with-optimistic-explicit-euler-volume-classes.png"
111 figure.savefig(output, dpi=100, bbox_inches=
"tight")
113 print(
"Wrote", output)
126 tempfile.gettempdir(),
"rusanov-with-optimistic-explicit-euler-illustrations-log.md"
129 with tempfile.TemporaryDirectory()
as directory:
130 peano_project =
peano4.api.Project([
"illustration"],
"illustration", directory=directory)
134 solver.add_pde_term(exahype2.api.DirichletBoundaryConditions(stateless=
False))
137 exahype2_project =
exahype2.api.Project([
"illustration"],
"illustration",
"illustration", directory=directory)
138 exahype2_project.set_global_simulation_parameters(
139 dimensions=2, offset=[0.0, 0.0], size=[1.0, 1.0], min_end_time=1.0, periodic_BC=[
False,
False]
142 solver.numerical_scheme.construct_output(exahype2_project, peano_project, time_step)
144 time_step.visualise(title=
"Time stepping task graph of RusanovWithOptimisticExplicitEuler")
145 output = os.path.join(
146 os.path.dirname(os.path.abspath(__file__)),
"rusanov-with-optimistic-explicit-euler-time-step-task-graph.png"
148 plt.gcf().savefig(output, dpi=90)
150 print(
"Wrote", output)