Math & ScienceNavier-Stokes Equations

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
DaveyBaby
Posts: 1
Joined: Wed Jan 30, 2013 5:34 pm

Navier-Stokes Equations

Post by DaveyBaby »

Hi! This took me ages as I'm new, so I thought I'd post it :-)

Don't mindlessly copy and paste though, there are so many different ways to write these equations, terms to include or ignore, etc. This is just a good starter.

Code: Select all

\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
  % loads »amsmath«


\title{Navier-Stokes in \LaTeX{}}			% used by \maketitle
\author{David Harland}		% used by \maketitle
\date{January 30th, 2013}					% used by \maketitle

\begin{document}
\maketitle						% automatic title!

\section{Navier-Stokes Equations}

\subsection{Einstein summation convention}

\begin{equation}
\frac{\partial \rho}{\partial t} + \frac{\partial(\rho u_{i})}{\partial x_{i}} = 0
\end{equation}

\begin{equation}
\frac{\partial (\rho u_{i})}{\partial t} + \frac{\partial[\rho u_{i}u_{j}]}{\partial x_{j}} = -\frac{\partial p}{\partial x_{i}} + \frac{\partial \tau_{ij}}{\partial x_{j}} + \rho f_{i} \end{equation}
\begin{equation}
\frac{\partial (\rho e)}{\partial t} + (\rho e+p)\frac{\partial u_{i}}{\partial x_{i}} = \frac{\partial(\tau_{ij}u_{j})}{\partial x_{i}} + \rho f_{i}u_{i} + \frac{\partial(\dot{ q_{i}})}{\partial x_{i}} + r \end{equation}
The Einstein summation convention dictates that: When a sub-indice (here $i$ or $j$) is twice or more repeated in the same equation, one sums across the n-dimensions. 
This means, in the context of Navier-Stokes in 3 spacial dimensions, that one repeats the term 3 times, each time changing the indice for one representing the corresponding dimension (ie $1,2,3$ or $x,y,z$). Equation 1 is therefore a shorthand representation of: $\frac{\partial \rho}{\partial t}+\frac{\partial(\rho u_{1})}{\partial x_{1}}+\frac{\partial(\rho u_{2})}{\partial x_{2}}+ \frac{\partial(\rho u_{3})}{\partial x_{3}}=0$.
Equation $2$ is actually a superposition of 3 separable equations which could be written in a 3-line form: one line equation for each $i$ in each of which one sums the three terms for the $j$ sub-indice.
\subsection{Classic $\longrightarrow , \otimes , \nabla$ notation}
\begin{equation}
\frac{\partial \rho}{\partial t} + \overrightarrow{\nabla}\cdot(\rho\overrightarrow{u})=0 \end{equation}
\begin{equation}
\frac{\partial(\rho \overrightarrow{u})}{\partial t} + \overrightarrow{\nabla}\cdot[\rho\overline{\overline{u\otimes u}}] = -\overrightarrow{\nabla p} + \overrightarrow{\nabla}\cdot\overline{\overline{\tau}} + \rho\overrightarrow{f} \end{equation}
\begin{equation}
\frac{\partial(\rho e)}{\partial t} + \overrightarrow{\nabla}\cdot((\rho e + p)\overrightarrow{u}) = \overrightarrow{\nabla}\cdot(\overline{\overline{\tau}}\cdot\overrightarrow{u}) + \rho\overrightarrow{f}\overrightarrow{u} + \overrightarrow{\nabla}\cdot(\overrightarrow{\dot{q}})+r \end{equation}

Here $\otimes$ denotes the tensorial product, forming a tensor from the constituent vectors. A double bar denotes a tensor. The three equations ($4,5,6$) are equivalent to ($1,2,3$).

\end{document}
P.S thanks go to Stefan_K and localghost for pointing me in the right direction with regards to writing compilable and therefore useful posts :-)

DaveyBaby
Last edited by DaveyBaby on Mon Feb 04, 2013 6:53 pm, edited 8 times in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Navier-Stokes Equations

Post by Stefan Kottwitz »

Hi,

welcome to the board,

and thank you for posting your code for those equations! Perhaps you noticed, I added code markup. There's a Code button which you can use. Benefits are better readability because of syntax highlighting, and readers even can open the code in an online compiler for testing, by just one click.

I did it, and noticed small errors: the symbols in the second subsection title require math mode ($...$), and \centerdot is unknown.

Generally, it would be great if you would post compilable examples, both if you would like to show something and in cases of discussing a problem. That makes all much easier and requires just a few lines more.

Stefan
LaTeX.org admin
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Navier-Stokes Equations

Post by localghost »

DaveyBaby wrote:[…] Don't mindlessly copy and paste though, there are so many different ways to write these equations, terms to include or ignore, etc. […]
Indeed. And since your code is neither complete nor compilable even when complemented to a minimal example, I think you don't mind if I present a version that is typeset with the common LaTeX commands and enhanced by the packages mathtools and physics.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{mathtools}  % loads »amsmath«
\usepackage{physics}

\begin{document}
  \section{Einstein summation convention}
    \begin{align}
      \pdv{\rho}{t}+\pdv{(\rho u_i)}{x_i} &= 0 \\
      \pdv{(\rho u_i)}{t}+\pdv{(\rho u_i u_j)}{x_j} &= -\pdv{p}{x_i}+\pdv{\tau_{ij}}{x_j}+\rho f_i \\
      \pdv{(\rho e)}{t}+(\rho e+p)\pdv{u_i}{x_i} &= \pdv{(\tau_{ij} u_j)}{x_i}+\rho f_i u_i+\pdv{(\dot{q}_i)}{x_i}+r \\
      \intertext{Classic notation}
      \vec{\nabla}\cdot(\rho\vec{u}) &= 0 \\
      \pdv{(\rho \vec{u})}{t}+\vec{\nabla}\cdot\rho\vec{u}\otimes\vec{u} &= -\vec{\nabla p}+\vec{\nabla}\cdot\Bar{\Bar{\tau}}+\rho\vec{f} \\
      \pdv{(\rho e)}{t}+\vec{\nabla}\cdot(\rho e+p)\vec{u} &= \vec{\nabla}\cdot(\Bar{\Bar{\tau}}\cdot\vec{u})+\rho\vec{f}\vec{u}+\vec{\nabla}\cdot\vec{\dot{q}}+r 
    \end{align}
\end{document}
One possible way to typeset this is shown in the corresponding article on Wikipedia [1].

[1] Navier–Stokes equations – Wikipedia, the free encyclopedia


Addendum:
Even after your edit(s) your code is still not compilable. So I (again) took your example and made it run capable. Besides we would appreciate if you use a code box to format source code.


Best regards and welcome to the board
Thorsten
Post Reply