Rayleigh-Bénard convection of an isoviscous Stokes fluid

Rayleigh-Bénard convection of an isoviscous Stokes fluid#

from lucifex.sim import run
from lucifex.utils import as_indices
from lucifex.solver import maximum
from lucifex.viz import plot_colormap, plot_line, create_animation, save_figure, display_animation
from py.C02_stokes_convection import stokes_rayleigh_benard_rectangle

simulation = stokes_rayleigh_benard_rectangle(
    aspect=2.0,  
    Nx=64,
    Ny=64,
    cell='quadrilateral',
    scaling='diffusive',
    Ra=5e4,
    c_ampl=1e-3,
    c_freq=(16, 8),
    dt_max=0.1, 
)

n_stop = 200
dt_init = 1e-6
n_init = 10
run(simulation, n_stop=n_stop, dt_init=dt_init, n_init=n_init)

c, u, p, up = simulation['c', 'u', 'p', 'up']
time_slice = slice(0, None, 2)
titles = [f'$c(t={t:.3f})$' for t in c.time_series[time_slice]]

anim = create_animation(
    plot_colormap,
    colorbar=False,
)(c.series[time_slice], title=titles)
anim_path = save_figure(f'{c.name}(x,y,t)', get_path=True)(anim)

display_animation(anim_path)
time_indices = as_indices(c.time_series, (0, 0.25, 0.5, 0.75, -1), fraction=True)
for i in time_indices:
    t = c.time_series[i]
    fig, ax = plot_colormap(c.series[i], title=f'$c(t={t:.2f})$')
    save_figure(f'c(x,y,t={c.time_series[i]:.3f})', thumbnail=(i == -1))(fig)
../../_images/cd536d34c423e2fdb05780ca8d095f338d7eb8212fb7ca4a53e1c38930c4c03b.png ../../_images/0b224dfa922566e67c13d324f42e5f603287bae0f1e3eaffcb99d16d6b593345.png ../../_images/6c21c3d6463adace41f8c18342ba9f0b96c7a80a87fa23a30342f11260e04599.png ../../_images/69231ce11276d0ecc2f63fd39241acd26828c5d8361904943b4ad7816099cb46.png ../../_images/5d846b6a2bc30089dfa99c6d7c0e030186c5d298b439383ea336e42478b700ee.png
u_max = [maximum(i) for i in u.series]
fig, ax = plot_line((u.time_series, u_max), x_label='$t$', y_label='$\max_{\mathbf{x}}|\mathbf{u}|$')
save_figure(f'uMax(t)')(fig)
../../_images/cbb5cf5ce6f32cbdcdce5ed0c79a037d37381b141baf3fbb9f067d8db9c1b9bc.png
The Kernel crashed while executing code in the current cell or a previous cell. 

Please review the code in the cell(s) to identify a possible cause of the failure. 

Click <a href='https://aka.ms/vscodeJupyterKernelCrash'>here</a> for more info. 

View Jupyter <a href='command:jupyter.viewOutput'>log</a> for further details.