Evolving convection of a Darcy fluid in an isotropic porous rectangle#
\[\begin{split}
\mathbb{S}
\begin{cases}
\Omega = [0, \mathcal{A}X] \times [0, X] & \text{aspect ratio }\mathcal{A}=\mathcal{O}(1)\\
\textbf{e}_g=-\textbf{e}_y & \text{vertically downward gravity}\\
\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}\\
c_0(x,y)=\lim_{\epsilon\to0}\left(1+\text{erf}\left(\frac{y-X}{\epsilon X}\right)\right)+\mathcal{N}(x,y) & \text{perturbed diffusive base state} \\
c_{\text{D}}(x,y=X)=1 & \text{`solute-rich' upper boundary} \\
c_{\text{N}}(x,y=0)=0 & \text{no-flux on 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}
\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, plot_line, save_figure, create_animation, display_animation
from py.C01_darcy_evolving import darcy_convection_evolving_rectangle
simulation = darcy_convection_evolving_rectangle(
aspect=2.0,
Nx=64,
Ny=64,
cell='quadrilateral',
scaling='advective',
Ra=500.0,
c_ampl=1e-4,
c_freq=(14, 14),
c_seed=(456, 987),
D_adv=AB2,
D_diff=CN,
diagnostic=True,
)
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.name}(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, -1), fraction=True)
for i in time_indices:
fig, ax = plot_colormap(c.series[i], title=f'${c.name}(t={c.time_series[i]:.2f})$')
save_figure(f'{c.name}(x,y,t={c.time_series[i]:.2f})', thumbnail=(i == -1))(fig)
uRMS, uMinMax = simulation['uRMS', 'uMinMax']
uMax = uMinMax.sub(1)
fig, ax = plot_line(
(uRMS.time_series, uRMS.value_series),
x_label='$t$',
y_label='$\mathrm{rms}(\mathbf{u})$',
)
save_figure('uRMS(t)')(fig)
fig, ax = plot_line(
(uMax.time_series, uMax.value_series),
x_label='$t$',
y_label='$\max_{\mathbf{x}}|\mathbf{u}|$',
)
save_figure('uMax(t)')(fig)
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.