Skip to content

Commit c48fdc2

Browse files
committed
More plots
1 parent b593ae2 commit c48fdc2

File tree

2 files changed

+29
-22
lines changed

2 files changed

+29
-22
lines changed

pySDC/projects/Resilience/RBC.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ def run_RBC(
172172
return stats, controller, crash
173173

174174

175-
def generate_data_for_fault_stats():
175+
def generate_data_for_fault_stats(Tend):
176176
prob = RayleighBenard(**PROBLEM_PARAMS)
177-
_ts = np.linspace(0, 22, 221, dtype=float)
177+
_ts = np.linspace(0, Tend, Tend * 10 + 1, dtype=float)
178178
for i in range(len(_ts) - 1):
179179
print(f'Generating reference solution from {_ts[i]:.4e} to {_ts[i+1]:.4e}')
180180
prob.u_exact(_ts[i + 1], _t0=_ts[i], recompute=False)
@@ -374,8 +374,8 @@ def plot_factorizations_over_time(t0=0, Tend=50, e_tol=1e-3, recompute=False, ad
374374

375375
if __name__ == '__main__':
376376
# plot_step_size(0, 30)
377-
plot_factorizations_over_time(e_tol=1e-3, adaptivity_mode='dt')
377+
generate_data_for_fault_stats(Tend=30)
378+
# plot_factorizations_over_time(e_tol=1e-3, adaptivity_mode='dt')
378379
# plot_factorizations_over_time(recompute=False, e_tol=1e-5, adaptivity_mode='dt_k')
379-
# generate_data_for_fault_stats()
380380
# check_order(t=20, dt=1., steps=7)
381381
# stats, _, _ = run_RBC()

pySDC/projects/Resilience/paper_plots.py

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -580,13 +580,14 @@ def plot_RBC_solution(setup='resilience'): # pragma: no cover
580580

581581
from mpl_toolkits.axes_grid1 import make_axes_locatable
582582

583+
nplots = 3 if setup == 'thesis_intro' else 2
584+
aspect = 0.8 if nplots == 3 else 0.5
583585
plt.rcParams['figure.constrained_layout.use'] = True
584-
fig, axs = plt.subplots(2, 1, sharex=True, sharey=True, figsize=figsize_by_journal(JOURNAL, 1.0, 0.5))
586+
fig, axs = plt.subplots(nplots, 1, sharex=True, sharey=True, figsize=figsize_by_journal(JOURNAL, 1.0, aspect))
585587
caxs = []
586-
divider = make_axes_locatable(axs[0])
587-
caxs += [divider.append_axes('right', size='3%', pad=0.03)]
588-
divider2 = make_axes_locatable(axs[1])
589-
caxs += [divider2.append_axes('right', size='3%', pad=0.03)]
588+
for ax in axs:
589+
divider = make_axes_locatable(ax)
590+
caxs += [divider.append_axes('right', size='3%', pad=0.03)]
590591

591592
from pySDC.projects.Resilience.RBC import RayleighBenard, PROBLEM_PARAMS
592593

@@ -607,15 +608,20 @@ def _plot(t, ax, cax):
607608
elif setup == 'resilience_thesis':
608609
_plot(20, axs[0], caxs[0])
609610
_plot(21, axs[1], caxs[1])
611+
elif setup == 'thesis_intro':
612+
_plot(0, axs[0], caxs[0])
613+
_plot(18, axs[1], caxs[1])
614+
_plot(30, axs[2], caxs[2])
610615

611-
axs[1].set_xlabel('$x$')
612-
axs[0].set_ylabel('$z$')
613-
axs[1].set_ylabel('$z$')
616+
for ax in axs:
617+
ax.set_ylabel('$z$')
618+
ax.set_aspect(1)
619+
axs[-1].set_xlabel('$x$')
614620

615621
savefig(fig, f'RBC_sol_{setup}', tight_layout=False)
616622

617623

618-
def plot_GS_solution(): # pragma: no cover
624+
def plot_GS_solution(tend=500): # pragma: no cover
619625
my_setup_mpl()
620626

621627
fig, axs = plt.subplots(1, 2, figsize=figsize_by_journal(JOURNAL, 1.0, 0.45), sharex=True, sharey=True)
@@ -641,19 +647,19 @@ def plot_GS_solution(): # pragma: no cover
641647
'Dv': 1e-5,
642648
}
643649
P = grayscott_imex_diffusion(**problem_params)
644-
Tend = 500
645-
im = axs[0].pcolormesh(*P.X, P.u_exact(0)[0], rasterized=True, cmap='binary')
646-
im1 = axs[1].pcolormesh(*P.X, P.u_exact(Tend)[0], rasterized=True, cmap='binary')
650+
Tend = tend
651+
im = axs[0].pcolormesh(*P.X, P.u_exact(0)[1], rasterized=True, cmap='binary')
652+
im1 = axs[1].pcolormesh(*P.X, P.u_exact(Tend)[1], rasterized=True, cmap='binary')
647653

648654
fig.colorbar(im, cax=cax[0])
649655
fig.colorbar(im1, cax=cax[1])
650-
axs[0].set_title(r'$u(t=0)$')
651-
axs[1].set_title(rf'$u(t={{{Tend}}})$')
656+
axs[0].set_title(r'$v(t=0)$')
657+
axs[1].set_title(rf'$v(t={{{Tend}}})$')
652658
for ax in axs:
653659
ax.set_aspect(1)
654660
ax.set_xlabel('$x$')
655661
ax.set_ylabel('$y$')
656-
savefig(fig, 'GrayScott_sol')
662+
savefig(fig, f'GrayScott_sol{f"_{tend}" if tend != 500 else ""}')
657663

658664

659665
def plot_Schroedinger_solution(): # pragma: no cover
@@ -896,6 +902,8 @@ def make_plots_for_notes(): # pragma: no cover
896902
def make_plots_for_thesis(): # pragma: no cover
897903
global JOURNAL
898904
JOURNAL = 'TUHH_thesis'
905+
for setup in ['thesis_intro', 'resilience_thesis', 'work_precision']:
906+
plot_RBC_solution(setup)
899907

900908
from pySDC.projects.Resilience.RBC import plot_factorizations_over_time
901909

@@ -918,9 +926,8 @@ def make_plots_for_thesis(): # pragma: no cover
918926
all_problems(**all_params, mode=mode)
919927
all_problems(**{**all_params, 'work_key': 'param'}, mode='compare_strategies')
920928

921-
plot_GS_solution()
922-
for setup in ['resilience_thesis', 'work_precision']:
923-
plot_RBC_solution(setup)
929+
for tend in [500, 2000]:
930+
plot_GS_solution(tend=tend)
924931
for setup in ['resilience', 'adaptivity']:
925932
plot_vdp_solution(setup=setup)
926933

0 commit comments

Comments
 (0)