Skip to content

Commit fccd045

Browse files
committed
Added plot of RBC solution
1 parent 71ac6c7 commit fccd045

File tree

1 file changed

+55
-12
lines changed

1 file changed

+55
-12
lines changed

pySDC/projects/Resilience/paper_plots.py

Lines changed: 55 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -188,21 +188,24 @@ def plot_recovery_rate_recoverable_only(stats_analyser, fig, ax, **kwargs): # p
188188
)
189189

190190

191-
def compare_recovery_rate_problems(**kwargs): # pragma: no cover
191+
def compare_recovery_rate_problems(target='resilience', **kwargs): # pragma: no cover
192192
"""
193-
Compare the recovery rate for vdP, Lorenz and Schroedinger problems.
193+
Compare the recovery rate for various problems.
194194
Only faults that can be recovered are shown.
195195
196196
Returns:
197197
None
198198
"""
199-
stats = [
200-
get_stats(run_RBC, **kwargs),
201-
get_stats(run_quench, **kwargs),
202-
get_stats(run_Schroedinger, **kwargs),
203-
get_stats(run_AC, **kwargs),
204-
]
205-
titles = ['Van der Pol', 'Quench', r'Schr\"odinger', 'Allen-Cahn']
199+
if target == 'resilience':
200+
problems = [run_Lorenz, run_Schroedinger, run_AC, run_RBC]
201+
titles = ['Lorenz', r'Schr\"odinger', 'Allen-Cahn', 'Rayleigh-Benard']
202+
elif target == 'thesis':
203+
problems = [run_vdp, run_Lorenz, run_AC, run_RBC] # TODO: swap in Gray-Scott
204+
titles = ['Van der Pol', 'Lorenz', 'Allen-Cahn', 'Rayleigh-Benard']
205+
else:
206+
raise NotImplementedError()
207+
208+
stats = [get_stats(problem, **kwargs) for problem in problems]
206209

207210
my_setup_mpl()
208211
fig, axs = plt.subplots(2, 2, figsize=figsize_by_journal(JOURNAL, 1, 0.8), sharey=True)
@@ -421,6 +424,42 @@ def plot_quench_solution(): # pragma: no cover
421424
savefig(fig, 'quench_sol')
422425

423426

427+
def plot_RBC_solution(): # pragma: no cover
428+
"""
429+
Plot solution of Rayleigh-Benard convection
430+
"""
431+
my_setup_mpl()
432+
433+
from mpl_toolkits.axes_grid1 import make_axes_locatable
434+
435+
plt.rcParams['figure.constrained_layout.use'] = True
436+
fig, axs = plt.subplots(2, 1, sharex=True, sharey=True, figsize=figsize_by_journal(JOURNAL, 1.0, 0.45))
437+
caxs = []
438+
divider = make_axes_locatable(axs[0])
439+
caxs += [divider.append_axes('right', size='3%', pad=0.03)]
440+
divider2 = make_axes_locatable(axs[1])
441+
caxs += [divider2.append_axes('right', size='3%', pad=0.03)]
442+
443+
from pySDC.projects.Resilience.RBC import RayleighBenard, PROBLEM_PARAMS
444+
445+
prob = RayleighBenard(**PROBLEM_PARAMS)
446+
447+
def _plot(t, ax, cax):
448+
u_hat = prob.u_exact(t)
449+
u = prob.itransform(u_hat)
450+
im = ax.pcolormesh(prob.X, prob.Z, u[prob.index('T')], rasterized=True)
451+
fig.colorbar(im, cax, label=f'$T(t={{{t}}})$')
452+
453+
_plot(0, axs[0], caxs[0])
454+
_plot(21, axs[1], caxs[1])
455+
456+
axs[1].set_xlabel('$x$')
457+
axs[0].set_ylabel('$z$')
458+
axs[1].set_ylabel('$z$')
459+
460+
savefig(fig, 'RBC_sol', tight_layout=False)
461+
462+
424463
def plot_Schroedinger_solution(): # pragma: no cover
425464
from pySDC.implementations.problem_classes.NonlinearSchroedinger_MPIFFT import nonlinearschroedinger_imex
426465

@@ -600,7 +639,9 @@ def make_plots_for_resilience_paper(): # pragma: no cover
600639
plot_recovery_rate(get_stats(run_vdp))
601640
plot_fault_vdp(0)
602641
plot_fault_vdp(13)
603-
compare_recovery_rate_problems(num_procs=1, strategy_type='SDC')
642+
compare_recovery_rate_problems(target='resilience', num_procs=1, strategy_type='SDC')
643+
644+
plot_RBC_solution()
604645

605646

606647
def make_plots_for_notes(): # pragma: no cover
@@ -619,9 +660,11 @@ def make_plots_for_thesis(): # pragma: no cover
619660
global JOURNAL
620661
JOURNAL = 'TUHH_thesis'
621662

622-
# plot_adaptivity_stuff()
663+
plot_RBC_solution()
623664
# plot_vdp_solution()
624-
compare_recovery_rate_problems(num_procs=1, strategy_type='SDC')
665+
666+
# plot_adaptivity_stuff()
667+
compare_recovery_rate_problems(target='thesis', num_procs=1, strategy_type='SDC')
625668

626669

627670
if __name__ == "__main__":

0 commit comments

Comments
 (0)