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
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'm going to derive incompressible version of Navier-Stokes equations governing motion of a fluid. Derivation is first step in our journey to numerical solution and computational simulation of fluid flow.
We should begin with very fundamental law, namely conservation of mass. It is quite obvious mass of fluid is defined as sum over control volumes multiplied by density.
Differentiating both sides with respect to time will result in
We can understand the change of density is equivalent to a flux through enclosed surface:
Applying divergence theorem yells:
Thus:
Now we should take into consideration the conservation of momentum, undesrtood as a $\rho \vec{v}$. We should start with defining momentum flowing in $i^{th}$ direction:
One more time we use time derivative:
Similarly as in 1.2 we use an idea of flow through closed surface:
Using divergence theorem gives us:
Thus:
The time has come to expand derivatives:
Suddenly the conservation of mass 1.4 should erect:
Finally we can simplify formula above by introducing something called material derrivative $\frac {D}{Dt}$:
Finally we should investigate non-relativistic momentum transport. I would like to briefly cover this topic, however if you are interested in farther investigation Wikipedia has some complex information:
from IPython.display import HTML
HTML('<iframe src=http://en.wikipedia.org/wiki/Cauchy_momentum_equation?useformat=mobile width=900 height=300></iframe>')
The most important for us part can be summarize in following equation, which is generalization of second law of newton for continuous flow. LHS represent the result of exerted force which is the change of momentum, and RHS its cause, namely stress $\int_\omega \nabla_j \sigma_{ij} dV$ and external force $ \int_\omega \rho f_i dV$ summed over all control volumes.
Where $\sigma_{ij}$ is a cauchy stress tensor, which has following significance and form:
Image(filename='stressedTensor.png', width=400)
Where $P$ is defined as a mean pressure according to the formula: \begin{equation*} P = -\frac{1}{3} (\sigma_{xx} + \sigma_{yy} + \sigma_{zz}) \quad(3.6) \end{equation*}
Inserting it into formula 3.4 yells our Navier-Stokes equation:
For compressible Newtonian fluid the daviatoric stress tensor $\tau$, which is part of stress tensor responsible for shear stresses, has the following relation:
For incompressible Newtonian fluid, where $\nabla \cdot v = 0$, it yells:
Where $\mu$ is proportionality factor called viscosity. We can calculate $\nabla \cdot \tau_{ij}$ for $j = 1$, it would mean for the x component of momentum:
Since usually the velocity component is defined as $\vec{v} = (u, v, w)$ and for other component we should expect similar results we might conclude:
\begin{equation*} \nabla \cdot \tau_{ij} = \mu (\Delta u + \Delta v + \Delta w) = \mu \Delta \vec{v} \quad(4.4) \end{equation*}
Finally we obtain desired Navier - Stokes equations for inconpressible flow:
For computational reasons it is helpful to express N-S equation in dimensionless form and to that end we sould introduce two quantities, characteristic length scale $L$ and characteristic velocity scale $U$. Then our variables change according to following transformation, where variables with tidles are our dimensionless variables:
Dropping tildes and substituting equation 5.1 to equation 4.5 will result in our final form of Navier - Stokes equation:
Where $Re$ is dimensionless Raynolds number $$Re = \frac{U L \rho}{\mu} $$
Since we are done with analytical part of the project the times has come to solve equation 5.2 numerically in python. If you are looking forward to next notebooks containing proper code visit and follow by2pie.com :
HTML('<iframe src=http://by2pie.wordpress.com width=900 height=500></iframe>')
2.2 Time discretization of Navier-Stokes Equations in 2D