from IPython.display import display, Image
from IPython.display import display_pretty, display_html, display_jpeg, display_png, display_json, display_latex, display_svg
from IPython.display import Latex
from IPython.display import HTML
Image(filename='logo3.jpg', width=100)
Project 2.1: Derivation of incompressible Navier - Stokes equations
Project 2.2: Time discretization of Navier-Stokes Equations in 2D
Project 2.3: Space discratization and update equations
Project 2.4: Project 2.4: Boundary condition, linear equation and visualization of N-S equations
Project 2.5: Full Code
In following notebook I would like to prepare ground for numerical solution of Navier - Stokes equation derived in previous notebook. Firstly I would like to discretize time dependence
Let me start with recalling derived Incompressible Navier-Stokes Equations:
We would like to investigate situation without external force, which would result in $\vec{f} = 0$. Introducing two-dimensional velocity $\vec{v} = [u, v]$ we obtain equation for $i^{th}$ component:
Where we found incompressible condition $\nabla \cdot \vec{v} = 0 $
Now let us expand summation convention, namely we should have $i=1,2$ equations with $j=1,2$ summation inside them
x - component: $i = 1, j=1,2$ \begin{equation*} \frac {\partial u}{\partial t} + \, \frac {\partial u^2}{\partial x} + \frac {\partial uv}{\partial y} +\frac {\partial P}{\partial x} - \frac {1}{Re} \bigg( \frac {\partial^2 u}{\partial x^2} + \frac {\partial^2 u}{\partial y^2} \bigg) =0 \quad(1.5a) \end{equation*} y - component: $i = 2, j=1,2$ \begin{equation*} \frac {\partial v}{\partial t} + \, \frac {\partial v^2}{\partial y} + \frac {\partial uv}{\partial x} +\frac {\partial P}{\partial y} - \frac {1}{Re} \bigg( \frac {\partial^2 y}{\partial x^2} + \frac {\partial^2 y}{\partial y^2} \bigg) =0 \quad(1.5b) \end{equation*}
With help of shorthand notation $\frac {\partial}{\partial a} = ()_a$ we end up with following set of 2D formulas:
We would like to use notation $U^n$ for quantity calculated in time $t = n \Delta t$, additionally we need to define discrete time derivative in a form of: $$\frac{U^{n+1} - U^n}{\Delta t}$$
Main idea lays behind dividing time dependent part of calculation into three parts:
It would require calculating midpoints values of velocity, namely:
Connecting ideas 2.1 and 2.2 we should obtain three steps:
Equations $(2.5)$ can be rewritten in vector form: $$\frac{1}{\Delta t} {\bf U}^{n+1}- \frac{1}{\Delta t} {\bf U}^{n} = - \frac {1}{\Delta t} \nabla \cdot {\bf P}^{n+1} \quad(2.5b) $$
It is straightly leading us to Poisson equation, especially if we introduce quantity $F$:
Next time we would like to discretise 2D space into square lattice and add write few fragments of code, but now application of derrived formulas to a flying plane:
Image("plane.jpg", width=800)
Do not forget to visit our website:
HTML('<iframe src=http://by2pie.wordpress.com width=900 height=500></iframe>')
[1]Seibold Benjamin, MIT: A compact and fast Matlab code solving the incompressible Navier-Stokes equations on ractangular domains,
[2]Matyka Maciej, Wroclaw University: Solution to two-dimensional Incompressible Navier-Stokes Equations with
SIMPLE, SIMPLER and Vorticity-Stream Function Approaches.
Driven-Lid Cavity Problem: Solution and Visualization.
Testing