Flow of a Navier-Stokes fluid with vertical forcing#
\[\begin{split}
\mathbb{S}
\begin{cases}
\Omega = [0, L_x] \times [0, L_y] \\
f_x = 0 \\
f_y(x,y) = 5y\sin(6\pi x/L_x) \\
\psi_{\text{D}}\vert_{\partial\Omega} = 0 & \text{equivalent to no-penetration } (\textbf{n}\cdot\textbf{u})\vert_{\partial\Omega}=0\\
\omega_{\text{D}}\vert_{\partial\Omega} = 0
\end{cases}
\end{split}\]
import numpy as np
from lucifex.sim import run
from lucifex.viz import plot_colormap, plot_contours, save_figure
from py.F03_navier_stokes_forced import navier_stokes_forced
Lx = 2.0
fy = lambda x: 5 * x[1] * np.sin(6 * np.pi * x[0] / Lx)
simulation = navier_stokes_forced(
Lx=Lx,
Ly=1.0,
Nx=64,
Ny=64,
fy=fy,
)
n_stop = 100
dt_init = 1e-6
n_init = 5
run(simulation, n_stop=n_stop, dt_init=dt_init, n_init=n_init)
psi = simulation['psi']
time_index = -1
fig, ax = plot_colormap(psi.series[time_index], title=f'$\psi(t={psi.time_series[-1]:.3f})$', x_label='$x$', y_label='$y$')
plot_contours(fig, ax, psi.series[time_index], use_cache=True, colors='cyan')
save_figure(f'psi(x,y,t={psi.time_series[time_index]:.3f})', thumbnail=True)(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.