Elder convection of a Darcy fluid in a porous rectangle

Elder convection of a Darcy fluid in a porous rectangle#

\[\begin{split} \mathbb{S}_{\psi,c} \begin{cases} \Omega = [0, \mathcal{A}X] \times [0, X] & \text{aspect ratio } \mathcal{A}=\mathcal{O}(1)\\ c_0(x,y)=\mathcal{N}(x,y) & \text{perturbed initial concentration} \\ c_{\text{D}}(x,y=X)=\begin{cases} 1 & x<\frac{\mathcal{A}X}{2} \\ 0 & \text{otherwise} \end{cases}=0 & \text{step concentration upper boundary} \\ c_{\text{D}}(x,y=0)=0 & \text{zero concentration lower boundary} \\ c_{\text{N}}(x=0,y)=0 & \text{no-flux on left boundary}\\ c_{\text{N}}(x=\mathcal{A}X,y)=0 & \text{no-flux on right boundary}\\ \psi_{\text{D}}\vert_{\partial\Omega}=0 & \text{no-penetration on entire boundary} \\ \phi = 1 & \text{constant porosity} \\ \mathsf{D} = \mathsf{I} & \text{constant isotropic dispersion} \\ \mathsf{K} = \mathsf{I} & \text{constant isotropic permeability} \\ \mu = 1 & \text{constant viscosity} \\ \rho(c) = c & \text{linear density} \\ \textbf{e}_g=-\textbf{e}_y & \text{vertically downward gravity}\\ \end{cases} \end{split}\]
from lucifex.fdm import AB2, CN
from lucifex.sim import run
from lucifex.utils.npy_utils import as_index
from lucifex.plt import plot_colormap, save_figure, create_animation, display_animation
from py.C18_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,
    c_limits=(0,1),
)

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)', return_path=True)(anim)

display_animation(anim_path)
time_indices = as_index(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