Elder convection of a Darcy fluid in a porous rectangle

Elder convection of a Darcy fluid in a porous rectangle#

\[\begin{split} \mathbb{S} \begin{cases} \Omega = [0, L_x] \times [0, 1] & \text{aspect ratio } L_x=\mathcal{O}(1)\\ \textbf{e}_g=-\textbf{e}_y & \text{vertically downward gravity}\\ c_0(x,y)=\mathcal{N}(x,y) & \text{initial perturbation} \\ c_{\text{D}}(x,y=1)=\begin{cases} 1 & x<\frac{L_x}{2} \\ 0 & \text{otherwise} \end{cases}=0 & \text{prescribed concentration on upper and lower boundaries} \\ c_{\text{D}}(x,y=0)=0 \\ c_{\text{N}}(x=0,y)=0 & \text{no-flux on left and right boundaries}\\ c_{\text{N}}(x=L_x,y)=0 \\ \psi_{\text{D}}\vert_{\partial\Omega}=0 & \text{no-penetration on entire boundary} \\ \phi = 1 & \text{constitutive relations} \\ \mathsf{D} = \mathsf{I} \\ \mathsf{K} = \mathsf{I}\\ \mu = 1 \\ \rho(c) = c \\ \end{cases} \end{split}\]
from lucifex.fdm import AB2, CN
from lucifex.sim import run
from lucifex.utils import as_indices
from lucifex.viz import plot_colormap, save_figure, create_animation, display_animation
from py.C01_darcy_elder import darcy_convection_elder_rectangle

simulation = darcy_convection_elder_rectangle(
    aspect=2.0,
    Nx=64,
    Ny=64,
    cell='quadrilateral', 
    scaling='advective',
    Ra=400.0, 
    c_ampl=1e-4, 
    c_freq=(12, 12), 
    c_seed=(789, 987), 
    D_adv=AB2 @ CN,
    D_diff=CN,
)

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

c = simulation['c']
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=(0, 1),
)(c.series[time_slice], title=titles)
anim_path = save_figure('c(t)', get_path=True)(anim)

display_animation(anim_path)
time_indices = as_indices(c.time_series, (0, 0.25, 0.5, -1), fraction=True)
for i in time_indices:
    fig, ax = plot_colormap(c.series[i], title=f'$c(t={c.time_series[i]:.2f})$')
    save_figure(f'c(t={c.time_series[i]:.2f})', thumbnail=(i == -1))(fig)
../../_images/5a2b2ccabfcc391b75c33b368b7bb1d72c03dce99c280570e9c47c8772c9baf5.png ../../_images/f661b16eb1d06096d6f0e647810dd31c62c919736bd2f1ba9c164477ceceae6d.png ../../_images/da03593eed2d2456c071b8247a28568414fbe729833ac065d45df408f11e03eb.png ../../_images/8ed3bf792fc2d2556f3a56adb6bbe1c0cea18e5abbc90f8c06c9d11b62571c5d.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.