Preview

Numerical Methods for Fluid Flow

Below is my final presentation from the UM Math Directed Reading Program.

Abstract: Estimating physical parameters from experimental data is a problem of great importance in the study of fluid flows. After introducing the Navier-Stokes equations for incompressible flow, we derive Couette flow as a concrete example of a steady-state solution around which linearization is possible. We investigate a computational approach for recovering the underlying system matrix from simulated streamline data from a linear flow field, examining the loss function landscape when the matrix is defective or ill-conditioned, as well as the effects of short-time data.

Below are some of my markdown notes for concepts covered and reviewed throughout the semester - seperate from my written notes.

Multivariable Calculus

The nabla operator represents the vector of partial derivatives:

=x,y,z\boxed{ \nabla = \left\langle \frac{\partial}{\partial x}, \frac{\partial}{\partial y}, \frac{\partial}{\partial z}\right\rangle }

Gradient

f=fx,fy,fz\boxed{ \nabla f = \left\langle \frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}, \frac{\partial f}{\partial z}\right\rangle }

The gradient of a scalar function gives the direction and rate of the greatest increase.

Written as gradf\mathrm{grad}\,f and f\nabla f.

Divergence

F=F1x+F2y+F3z\boxed{ \nabla\cdot F = \frac{\partial F_1}{\partial x} + \frac{\partial F_2}{\partial y} + \frac{\partial F_3}{\partial z} }

The divergence of a vector field is the extent to which the vector field flux behaves like a source or a sink at a given point.

Written as divF\mathrm{div}\,F, and F\nabla\cdot F. It is proper to write the \nabla as \vec{\nabla} since it behaves like a vector operator in three-dimensional space.

Divergence Theorem

V(F)dV=S(Fn)dS\boxed{ \int_V(\nabla\cdot F)\,dV = \int_S(F\cdot\vec n)\,dS }

The dot product FnF \cdot n measures the component of FF that is perpendicular to the surface at each point, which is essential for calculating the flux through the surface.

Note: a common notation in the Chorin textbook is to use WW to represent a region in the fluid at a particular time tt, and W\partial W to represent the surface that encloses WW ("the boundary of WW").

Week 2 recap

image.png

density: ρ(x,t)\rho(x, t)

velocity: u(x,t)u(x,t)

pressure: p(x,t)p(x,t)

Goal #1: Derive Euler’s Equation using the Net Force Equation

Net Force Equation (Newton’s second law of motion):

F=ma=mdudt=ddt(ma)=dpdt,where p is momentum\begin{align} \vec F &= m\vec a\\ &= m \frac{d\vec u}{dt} = \frac{d}{dt}(m\vec a) = \frac{d\vec p}{dt}, \textrm{where }\vec p\textrm{ is momentum}\\ \end{align}

Inviscid Fluid: no (dynamic) viscosity (μ=0)(\mu = 0)

Making the assumption that there is no viscosity allows us to represent the following quantities in a simplified form:

Note: pressure is pp, momentum is p\vec p.

Momentum in V=VρudVGravity force(body force)=VρgdVForce due to pressure=SpndS\begin{align} \textrm{Momentum in }V&=\int_V \rho\vec u\, dV\\ \underset{\textrm{(body force)}}{\textrm{Gravity force}} &= \int_V\rho\vec g \, dV\\ \textrm{Force due to pressure} &= -\int_S p\vec n \, dS \end{align}

Question: What are the units for the total momentum in VV?

Density is expressed as mass over a cubic volume, and velocity is expressed as length over time, so we have that [ρ][u]=ML3LT=ML2T[\rho][\vec u]=\frac{M}{L^3}\frac{L}{T}=\frac{M}{L^2T}. Then, we integrate over volume, so we multiply our units by L3L^3 to get [p]=MLT[\vec p]=M\frac{L}{T}

units of pressure: [p]=FL2[p] = \frac{F}{L^2}

ddtVρudV=SpndS+VρgdV\frac{d}{dt}\int_V \rho\vec{u}\,dV=-\int_Sp\vec n\,dS+\int_V\rho\vec g \,dV

Leibniz integral rule (swap integral and derivative)

Vt(ρu)dV=SpndS+VρgdV\int_V\frac{\partial}{\partial t}(\rho \vec u)\,dV = -\int_Sp\vec n\,dS+\int_V\rho\vec g\, dV

Divergence Theorem: V(F)dV=S(Fn)dS\int_V(\nabla\cdot F)\,dV = \int_S(F\cdot\vec n)\,dS

SpndS=VpdV-\int_Sp\vec n\,dS = \int_V\vec\nabla p\,dV

Here, because pp is a scalar, we write p\vec\nabla p instead of p\vec\nabla\cdot p.

Now, we go back to the net force equation, which states that F=dpdt\vec F=\frac{d\vec p}{dt}. We have two forces we are considering in this simplified example:

We also consider the “net rate of momentum flow into VV” as a separate force into VV. Because the volume is fixed but the particles are in motion, we account for the momentum of the volume changing as a result of fluid carrying momentum into or out of the volume through its boundaries. If we were dealing with solids, this would not be a factor since the particles would be fixed.

ddt(momentum in V)=net force on V+net rate of momentum flow into V\frac{d}{dt}(\textrm{momentum in V}) = \textrm{net force on V} + \textrm{net rate of momentum flow into V}

Note: Eulerian vs Lagrangian Perspective

image2.png

Lagrangian: ft\frac{\partial f}{\partial t}

Eulerian: ft+(u)f\frac{\partial f}{\partial t} + (\vec u \cdot \vec\nabla)f

Eulerian fluid analysis focuses on fixed points in space, whereas Lagrangian fluid analysis tracks individual particles by following them around and tracking how they change over time. Eulerian is more fitting for studying overall flow characteristics.

Back to derivation:

ddt(momentum in V)=net force on V+net rate of momentum flow into V\frac{d}{dt}(\textrm{momentum in V}) = \textrm{net force on V} + \textrm{net rate of momentum flow into V}

ddtVρudV=SpndS+VρgdVS(ρu)(un)vol per timedS\Rightarrow \frac{d}{dt}\int_V \rho\vec{u}\,dV=-\int_Sp\vec n\,dS+\int_V\rho\vec g \,dV - \int_S(\rho\vec{u})\underbrace{(\vec u \cdot \vec n)}_\textrm{vol per time}\,dS

Apply Leibnez, divergence theorem, and reorder terms / move parentheses

Vt(ρu)dV=VpdV+VρgdVS(ρuu)ndS\int_V\frac{\partial}{\partial t}(\rho \vec u)\,dV = -\int_V\vec\nabla p\,dV+\int_V\rho\vec g\, dV-\int_S(\rho\vec u \vec u)\cdot\vec n\,dS

Combine like terms:

Vt(ρu)+pρgdV=S(ρuu)ndS\int_V\frac{\partial}{\partial t}(\rho \vec u)+ \vec\nabla p -\rho\vec g\, dV=-\int_S(\rho\vec u \vec u)\cdot\vec n\,dS

divergence theorem

Vt(ρu)+pρgdV=V(ρuu)dV\int_V\frac{\partial}{\partial t}(\rho \vec u)+ \vec\nabla p -\rho\vec g\, dV=-\int_V\vec\nabla\cdot(\rho\vec u \vec u)\,dV

Inner expressions must be equal

t(ρu)+pρg+(ρuu)=0\frac{\partial}{\partial t}(\rho \vec u)+ \vec\nabla p -\rho\vec g +\vec\nabla\cdot(\rho\vec u \vec u)=\vec 0

product rule

ρtu+ρut+(ρu)u+ρ(uu)=p+ρg\frac{\partial \rho}{\partial t}\vec u + \rho \frac{\partial \vec u}{\partial t} + \vec\nabla\cdot(\rho \vec u)\vec u + \rho (\vec u \cdot \vec\nabla \vec u) = - \vec\nabla p + \rho \vec g

(ρt+(ρu))=0u+ρ(ut+(u)u)=+ρg\underbrace{(\frac{\partial \rho}{\partial t} + \vec\nabla\cdot(\rho\vec u))}_{=0}\vec u + \rho (\frac{\nabla \vec u}{\partial t} + (\vec u\cdot \vec \nabla)\vec u) = -\vec\nabla + \rho g

Total derivative: Dfa=[fx1(a)fxn(a)]Df_a = [\frac{\partial f}{\partial x_1}(a) \cdots \frac{\partial f}{\partial x_n}(a)]

(ut+(u)u)=DuDt\Rightarrow(\frac{\partial \vec u}{\partial t}+(\vec u \cdot \vec\nabla)\vec u) = \frac{D\vec u}{D t}

ρDuDt=p+ρg\Rightarrow \rho \frac{D\vec u}{D t} = -\nabla p+\rho\vec g

Euler's Equations

Law of conservation of mass

The rate of increase of mass in WW equals the rate at which mass is crossing W\partial W in the inward direction:

ddtWρdV=WρundA\frac{d}{dt}\int_W \rho dV = -\int_{\partial W} \rho \vec{u}\cdot \vec{n} d A

This is the "integral form" of the law of conservation of mass.

Continuity Equation

By the divergence theorem, this is equivalent to

W[ρt+div(ρu)]dV=0\int_W\left[\frac{\partial\rho}{\partial t} + \mathrm{div}(\rho \vec u)\right] dV = 0

Because this is true for all W, it is equivalent to:

ρt+div(ρu)=0\boxed{ \frac{\partial\rho}{\partial t} + \mathrm{div}(\rho \vec u) = 0 }

This is the continuity equation, also known as the "differential form" of the law of conservation of mass.

Material Derivative

DDtf=(t+u)f\frac{D}{Dt}f = \left(\frac{\partial}{\partial t} + \vec{u}\cdot\vec{\nabla}\right)f

Main idea: the material deriviative takes into account the fact that the fluid is moving and that the positions of fluid particles change with time.

Example:

DuDt=ddtu(x(t),t)\frac{D\vec u}{Dt} = \frac{d}{dt}\vec{u}(\vec{x}(t),t)

gives the velocity following a fluid particle

Balance of momentum

An ideal fluid is one with the following property:

For any motion of the fluid there is a function p(x,t)p(\vec x,t) called the pressure such that is SS is a surface in the fluid with a chosen unit normal n\vec n, the force of stress exerted across the surface SS per unit area at xS\vec x \in S at time tt is p(x,t)np(\vec x,t)n. Note that the force is in the direction n\mathbf{n} and that the force acts orthogonally to the surface SS; that is, there are no tangental forces (see Figure 1.1.3).

02_1

If b(x,t)\vec{b}(\vec{x}, t) denotes the given body force per unit mass, we have the total body force B=WρbdV\vec B = \int_W \rho \vec b \,dV. Thus, on any piece of fluid material, the force per unit volume is equal to gradp+ρb-\mathrm{grad}\,p + \rho \vec b.

This along with Newton's second law (F=dρ/dtF=d\rho/dt) leads us to the differential form of the law of balance of momentum:

ρDuDt=gradp+ρb\boxed{ \rho \frac{D \vec u}{D t} = -\mathrm{grad}\,p+\rho \vec b }

In some other resources, the body force bb is omitted (assumed to be zero) for simplicity. However, including bb makes the formulation more general. Including ρ\rho on both sides covers both compressible and incompressible fluids.

Balance of momentum is often used interchangeably with conservation of momentum. The use of the word balance emphasizes the ongoing equilibrium between the forces applied to a fluid and the resulting change in its momentum - accounting for the fact inflows, outflows, and forces must be accounted for at every instant, not just that total momentum doesn't change over time.

Newton's third law ensures that momentum exchanged internally cancels out, leaving only external forces to change total momentum.

Reynolds Transport Theorem

ddtWtρfdV=WtρDfDtdV\boxed{ \frac{d}{dt}\int_{W_t}\rho f\,dV=\int_{W_t}\rho\frac{Df}{Dt}\,dV }

ddtWtfdV=Wt(ft+div(fu))dV\boxed{ \frac{d}{dt}\int_{W_t} f\,dV=\int_{W_t}\left(\frac{\partial f}{\partial t}+ \mathrm{div}(f\vec u)\right)\,dV }

momentum conservation

Incompressibility

We call a flow incompressible if for any fluid subregion WW,

volume(Wt)=WTdV=constant in t\textrm{volume}(W_t) = \int_{W_T} dV = \textrm{constant in }t

The following statements are equivalent:

  1. the fluid is incompressible
  2. divu=0\mathrm{div}\,\vec u = 0
  3. J1J \equiv 1
  4. Dρ/Dt=0D\rho/D t = 0
    • "The mass density is constant following the fluid"
  5. ρ\rho is constant
  6. u=0\nabla\cdot\vec{u} = 0

Homogeneous fluid means that ρ\rho is constant in space. Incompressible fluid means that ρ\rho is constant in time.

[!NOTE] Problems involving inhomogeneous incompressible flow occur, for example, in oceanography

Main idea: An increasing amount of fluid cannot be stored in a fixed volume, because that would necessitate that the fluid be compressed into that volume. The rate of fluid entering must be exactly matched by the rate leaving which mathematically implies that the div of the mass flow rate is zero: An increasing amount of fluid cannot be stored in a fixed volume, because that would necessitate that the fluid be compressed into that volume. The rate of fluid entering must be exactly matched by the rate leaving which mathematically implies that the div of the mass flow rate is zero.

Wikipedia article on incompressible flow

The Euler equations

Assuming incompressibility, the Euler equations are:

ρDuDt=gradp+ρbDρDt=0divu=0\begin{align} \rho\frac{D\vec u}{D t} &= -\mathrm{grad}\,p + \rho \vec{b}\\ \frac{D\rho}{D t} &= 0\\ \mathrm{div}\,\vec{u} &= 0\\ \end{align}

with the boundary conditions un=0 on D\vec{u}\cdot\vec{n} = 0\textrm{ on }\partial D.

  1. Balance of momentum
  2. Density conservation as fluid particles move (incompressibility)
  3. Rate of fluid entering must exactly match the rate leaving (incompressibility)

See also: Elementary Fluid Dynamics

non-linear dynamics - chaos

bifercation analysis solution looks normal, as parameter varys solution oscillates, etc

Boyce D. Prima skim chapter 2 7.1 - 7.8

Differential Equations

First-order ordinary differential equations (ODEs)

1) Systems of First Order Linear Equations

x(n)+an1x(n1)++a2x+a1x+a0x=0x^{(n)} + a_{n-1}x^{(n-1)} + \dots + a_2x^{\prime\prime}+a_1x^\prime + a_0x = 0

Key idea: Every higher-order ODE can be rewritten as a system of first-order ODEs.

This is done by introducing new variables for each derivative:

x1=y,x2=y,x3=y,,xn=y(n1)x_1 = y,\, x_2 = y^\prime,\, x_3 = y^{\prime\prime},\,\dots,\, x_n = y^{(n-1)}

Then the system becomes:

x1=x2,x2=x3,x3=x4,,xn1=xnx_1^\prime = x_2,\\ x_2^\prime = x_3,\\ x_3^\prime = x_4,\\ \dots,\\ x_{n-1}^\prime = x_n

And we have:

xn=F(t,x1,x2,,xn)x(n)=a0x1a1x2a2x3an1xn\begin{align} x_n^\prime &= F(t, x_1, x_2, \dots, x_n)\\ \Rightarrow x^{(n)} &= -a_0x_1 - a_1x_2 - a_2x_3 - \dots - a_{n-1}x_n \end{align}

This system of equations can be written in matrix form:

04_2

x=Ax\vec x^\prime = \mathbf{A}\vec x

Key idea: eigenvalues of A\mathbf{A} are roots of characteristic polynomial; eigenvalue equation of equivalent system is equivalent to characteristic polynomial of the original higher-order equation

RecalL: eigs(A) are λ’s that satisfy det(AλI)=0\mathrm{eigs}(A) \textrm{ are } \lambda\textrm{'s that satisfy } \mathrm{det}(A-\lambda I) = 0 04_4

5) Homogeneous Linear Systems with Constant Coefficients

04_5

For general system x=Ax\vec x^\prime = \mathbf{A}\vec x, we want a change of coordinates x=Tzx = \mathbf{T}\vec z that diagonalizes my ODE

in this z-coordinate system, I want z=Dz\vec z^\prime = \mathbf{D}\vec z, where D\mathbf{D} is decoupled and diagonal.

z=Dzz(t)=eDtz(0)\vec z^\prime = \mathbf{D}\vec z \Rightarrow \vec{z}(t) = e^{Dt}\vec z(0)

Eigenvalues

The eigenvalues r1,,rnr_1,\,\dots,\,r_n (which need not all be different) are roots of the $n$th degree polynomial equation

det(ArI)=0\mathrm{det}(\mathbf{A}-r\mathbf{I}) = 0

If A\mathbf{A} is a real-valued matrix, there are three possibilities for the eigenvalues of A\mathbf{A}:

  1. All eigenvalues are real and different from each other.
  2. Some eigenvalues occur in complex conjugate pairs.
  3. Some eigenvalues are repeated.

If the eigenvalues are all real and different, then we have nn eigenvectors v1,,vn\vec{v}_1,\,\dots,\,\vec{v}_n which are linearly independent. The corresponding solutions of the differential system are

x(1)(t)=v1er1t,,x(n)(t)=vnerntx^{(1)}(t) = \vec{v}_1e^{r_1t},\, \dots,\, x^{(n)}(t) = \vec{v}_ne^{r_nt}

To find eigenvalues, solve det(AλI)=0\mathrm{det}(A-\lambda I ) = 0. For each eigenvalue λ\lambda, solve the equation (AλI)v=0(A-\lambda I)v = 0 to find the corresponding eigenvectors vv.

Eigenvalues: three cases

  1. eigenvalues are real and have opposite signs; x=0x=0 is a saddle point.
  2. eigenvalues are real and have the same sign but are unequal; x=0x=0 is a node.
  3. eigenvalues are complex with nonzero real part; x=0x=0 is a spiral point.

Initial Value Problem

A=[a11a12a21a22] A= \left[ {\begin{array}{cc} a_{11} & a_{12} \\ a_{21} & a_{22} \\ \end{array} } \right]

Compute eigenvalues λ1,λ2\lambda_1, \lambda_2 and eigenvectors v1,v2v_1, v_2.

Then the general solution is:

x(t)=c1eλ1tv1+c2eλ2tv2x(t) = c_1e^{\lambda_1t}v_1 + c_2e^{\lambda_2t}v_2

The constants c1,c2c_1, c_2 are chosen to meet initial conditions

IVP Using Diagonalization:

A=[a11a12a21a22] A= \left[ {\begin{array}{cc} a_{11} & a_{12} \\ a_{21} & a_{22} \\ \end{array} } \right]

x(t)=eAtx0x(t) = e^{At} x_0

If AA diagonalizable (has nn linearly independent eigenvectors), then A=PDP1A=PDP^{-1}, with DD diagonal and PP invertable. The matrix PP has the eigenvectors as its columns.

DD can be constructed by placing the eigenvalues on the main diagonal in any order, with zeros elsewhere. PP is constructed using the corresponsing eigenvectors as its columns; the order of the eigenvectors must correspond to the order of the eigenvalues in matrix DD.

Then, eAt=PeDtP1e^{At} = Pe^{Dt}P^{-1}, where eDte^{Dt} is a diagonal matrix with eλ1te^{\lambda_1t} and eλ2te^{\lambda_2t} on the diagonal

Steve Brunton - Motivating Eigenvalues and Eigenvectors with Differential Equations

Defective matrix

wiki article

note: distinct eigenvalues always have linearly independent eigenvectors.

eigenvalue has geometric multiplicity <\lt algebraic multiplicity (defective eigenvalue)

Two cool notes

D1=[1/D11001/D22] D^{-1}= \left[ {\begin{array}{cc} 1/D_{11} & 0 \\ 0 & 1/D_{22} \\ \end{array} } \right]

Repetition of eigenvalues

pg 398

Condition Number

https://www.google.com/search?q=condition+numbers+of+a+matrix&rlz=1C5CHFA_enUS1119US1119&oq=condition+numbers+of+a+matrix&gs_lcrp=EgZjaHJvbWUyBggAEEUYOTIGCAEQRRg5MgoIAhAAGAoYFhgeMg0IAxAAGIYDGIAEGIoFMg0IBBAAGIYDGIAEGIoFMgoIBRAAGIAEGKIEMgoIBhAAGKIEGIkF0gEINTE5OGowajGoAgCwAgA&sourceid=chrome&ie=UTF-8

cs357

Condition Numbers - Numberical Methods Course

Loss Function Analysis

Semi simplicity:

diagonalizable:

A square matrix that is not diagonalizable is called defective. It can happen that a matrix AA with real entries is defective over the real numbers, meaning that A=PDP1A=PDP^{-1} is impossible for any invertible PP and diagonal DD with real entries, but it is possible with complex entries, so that AA is diagonalizable over the complex numbers. For example, this is the case for a generic rotation matrix.

Here we assume T<<1T<<1

J(θ)=0Txθ(t)x(t)2dtJ(\theta) = \int_0^T \| \vec x_\theta(t) - \vec x(t) \|^2 \,\text{d}t

Jθi=0Tθi[(xθx)(xθx)]dt=0,i=1,2,3,4\frac{\partial J}{\partial \theta_i} = \int_0^T \frac{\partial}{\partial\theta_i}\left[ (x_\theta - x) \cdot (x_\theta - x)\right]\,\text{d}t = 0,\, \forall i=1,2,3,4

Condition Number

https://www.google.com/search?q=condition+numbers+of+a+matrix&rlz=1C5CHFA_enUS1119US1119&oq=condition+numbers+of+a+matrix&gs_lcrp=EgZjaHJvbWUyBggAEEUYOTIGCAEQRRg5MgoIAhAAGAoYFhgeMg0IAxAAGIYDGIAEGIoFMg0IBBAAGIYDGIAEGIoFMgoIBRAAGIAEGKIEMgoIBhAAGKIEGIkF0gEINTE5OGowajGoAgCwAgA&sourceid=chrome&ie=UTF-8

cs357

Condition Numbers - Numberical Methods Course