<<

Incompressible Fluid Flow

Andrew Hazel I Consider conservation of physical quantities over a fixed control volume, V, with outer unit normal, n:

V ∂V

n

Introduction

I The state of motion of a fluid is characterised by I velocity (vector) field ui (x, t), I internal stress (tensor) field σij (x, t), I density (scalar) field ρ (x, t). Introduction

I The state of motion of a fluid is characterised by I velocity (vector) field ui (x, t), I internal stress (tensor) field σij (x, t), I density (scalar) field ρ (x, t).

I Consider conservation of physical quantities over a fixed control volume, V, with outer unit normal, n:

V ∂V

n I The volume is fixed and theorem gives ZZZ ∂ρ ∂(ρu ) + j − q dV = 0, V ∂t ∂xj

I must be satisfied for any control volume and so taking the infinitessimal gives ∂ρ + ∇·(ρu) = q. (1) ∂t

Conservation of mass

d ZZZ ZZ ZZZ ρ dV + ρuj nj dS = q dV , dt V ∂V V rate of change of mass + outflux of mass = total source of mass. I Equation must be satisfied for any control volume and so taking the infinitessimal limit gives ∂ρ + ∇·(ρu) = q. (1) ∂t

Conservation of mass

d ZZZ ZZ ZZZ ρ dV + ρuj nj dS = q dV , dt V ∂V V rate of change of mass + outflux of mass = total source of mass.

I The volume is fixed and gives ZZZ ∂ρ ∂(ρu ) + j − q dV = 0, V ∂t ∂xj Conservation of mass

d ZZZ ZZ ZZZ ρ dV + ρuj nj dS = q dV , dt V ∂V V rate of change of mass + outflux of mass = total source of mass.

I The volume is fixed and divergence theorem gives ZZZ ∂ρ ∂(ρu ) + j − q dV = 0, V ∂t ∂xj

I Equation must be satisfied for any control volume and so taking the infinitessimal limit gives ∂ρ + ∇·(ρu) = q. (1) ∂t I Fixed control volume and use of divergence theorem gives ZZZ ∂ρui ∂ρui uj ∂σij + − − Fi dV = 0. V ∂t ∂xj ∂xj

I Taking the infinitessimal limit again leads to ∂(ρu) + ∇ · (ρuu) = ∇ · σ + F. (2) ∂t

Conservation of momentum

d ZZZ ZZ ZZ ZZZ ρui dV + ρui uj nj dS = σij nj dS + Fi dV . dt V ∂V ∂V V rate of change of momentum + outflux of momentum = resultant force. I Taking the infinitessimal limit again leads to ∂(ρu) + ∇ · (ρuu) = ∇ · σ + F. (2) ∂t

Conservation of momentum

d ZZZ ZZ ZZ ZZZ ρui dV + ρui uj nj dS = σij nj dS + Fi dV . dt V ∂V ∂V V rate of change of momentum + outflux of momentum = resultant force.

I Fixed control volume and use of divergence theorem gives ZZZ ∂ρui ∂ρui uj ∂σij + − − Fi dV = 0. V ∂t ∂xj ∂xj Conservation of momentum

d ZZZ ZZ ZZ ZZZ ρui dV + ρui uj nj dS = σij nj dS + Fi dV . dt V ∂V ∂V V rate of change of momentum + outflux of momentum = resultant force.

I Fixed control volume and use of divergence theorem gives ZZZ ∂ρui ∂ρui uj ∂σij + − − Fi dV = 0. V ∂t ∂xj ∂xj

I Taking the infinitessimal limit again leads to ∂(ρu) + ∇ · (ρuu) = ∇ · σ + F. (2) ∂t I For a Newtonian fluid the stress tensor has the form   ∂ui ∂uj σij = −p δij + µ + , ∂xj ∂xi

where p(x, t) is the fluid pressure.

I Hence, the momentum equation becomes      ∂ui ∂ui ∂p ∂ ∂ui ∂uj ρ + uj = − + µ + + Fi . ∂t ∂xj ∂xi ∂xj ∂xj ∂xi

Incompressible, Newtonian Fluid

I If the fluid is incompressible, density is constant and the (1) and (2) become   ∂ui ∂(ui uj ) ∂σij ∂uj ρ + = + Fi and = q. ∂t ∂xj ∂xj ∂xj I Hence, the momentum equation becomes      ∂ui ∂ui ∂p ∂ ∂ui ∂uj ρ + uj = − + µ + + Fi . ∂t ∂xj ∂xi ∂xj ∂xj ∂xi

Incompressible, Newtonian Fluid

I If the fluid is incompressible, density is constant and the equations (1) and (2) become   ∂ui ∂(ui uj ) ∂σij ∂uj ρ + = + Fi and = q. ∂t ∂xj ∂xj ∂xj

I For a Newtonian fluid the stress tensor has the form   ∂ui ∂uj σij = −p δij + µ + , ∂xj ∂xi

where p(x, t) is the fluid pressure. Incompressible, Newtonian Fluid

I If the fluid is incompressible, density is constant and the equations (1) and (2) become   ∂ui ∂(ui uj ) ∂σij ∂uj ρ + = + Fi and = q. ∂t ∂xj ∂xj ∂xj

I For a Newtonian fluid the stress tensor has the form   ∂ui ∂uj σij = −p δij + µ + , ∂xj ∂xi

where p(x, t) is the fluid pressure.

I Hence, the momentum equation becomes      ∂ui ∂ui ∂p ∂ ∂ui ∂uj ρ + uj = − + µ + + Fi . ∂t ∂xj ∂xi ∂xj ∂xj ∂xi I The momentum equation becomes

2   ρU ∂ui ρU ∂ui P ∂p µU ∂ ∂ui ∂uj + uj = − + 2 + +Fi . T ∂t L ∂xj L ∂xi L ∂xj ∂xj ∂xi

I If we choose to the pressure scale to be the viscous scale P = µU/L

    2 ρUL L ∂ui ∂ui ∂p ∂ ∂ui ∂uj L + uj = − + + + Fi . µ UT ∂t ∂xj ∂xi ∂xj ∂xj ∂xi µU

Non-dimensionalisation

I We choose typical, length, velocity, pressure and time scales so that

xi = L xi , ui = U ui , p = P p and t = T t,

where ui is the dimensionless velocity, etc. I If we choose to the pressure scale to be the viscous scale P = µU/L

    2 ρUL L ∂ui ∂ui ∂p ∂ ∂ui ∂uj L + uj = − + + + Fi . µ UT ∂t ∂xj ∂xi ∂xj ∂xj ∂xi µU

Non-dimensionalisation

I We choose typical, length, velocity, pressure and time scales so that

xi = L xi , ui = U ui , p = P p and t = T t,

where ui is the dimensionless velocity, etc.

I The momentum equation becomes

2   ρU ∂ui ρU ∂ui P ∂p µU ∂ ∂ui ∂uj + uj = − + 2 + +Fi . T ∂t L ∂xj L ∂xi L ∂xj ∂xj ∂xi Non-dimensionalisation

I We choose typical, length, velocity, pressure and time scales so that

xi = L xi , ui = U ui , p = P p and t = T t,

where ui is the dimensionless velocity, etc.

I The momentum equation becomes

2   ρU ∂ui ρU ∂ui P ∂p µU ∂ ∂ui ∂uj + uj = − + 2 + +Fi . T ∂t L ∂xj L ∂xi L ∂xj ∂xj ∂xi

I If we choose to the pressure scale to be the viscous scale P = µU/L

    2 ρUL L ∂ui ∂ui ∂p ∂ ∂ui ∂uj L + uj = − + + + Fi . µ UT ∂t ∂xj ∂xi ∂xj ∂xj ∂xi µU Non-dimensionalisation

I In the absence of any body forces Fi = 0 and the momentum equation becomes (drop the overbars)     ∂ui ∂ui ∂p ∂ ∂ui ∂uj Re St + uj = − + + , ∂t ∂xj ∂xi ∂xj ∂xj ∂xi where ρUL L Re = and St = , µ UT the Reynolds and Strouhal numbers respectively.

I The conservation of mass equation remains essentially the same; and in the absence of any sources or sinks of mass ∂u j = 0. ∂xj I What basis functions should we choose for the velocity and pressure?

I How do we impose boundary conditions?

Finite Element Method

I When considering a finite element approach, the following questions naturally arise:

I What is the weak form of the Navier–Stokes equations? I How do we impose boundary conditions?

Finite Element Method

I When considering a finite element approach, the following questions naturally arise:

I What is the weak form of the Navier–Stokes equations?

I What basis functions should we choose for the velocity and pressure? Finite Element Method

I When considering a finite element approach, the following questions naturally arise:

I What is the weak form of the Navier–Stokes equations?

I What basis functions should we choose for the velocity and pressure?

I How do we impose boundary conditions? I Weaken the differentiability requirements by integrating the stress-tensor terms by parts

Weak form of the Navier–Stokes equations

I Take the dot product of the momentum equation with a suitable vector-valued test , ψi , and integrate ZZ      ∂ui ∂ui ∂p ∂ ∂ui ∂uj Re St + uj + − + ψi dV = 0. ∂t ∂xj ∂xi ∂xj ∂xj ∂xi Weak form of the Navier–Stokes equations

I Take the dot product of the momentum equation with a suitable vector-valued test function, ψi , and integrate ZZ      ∂ui ∂ui ∂p ∂ ∂ui ∂uj Re St + uj + − + ψi dV = 0. ∂t ∂xj ∂xi ∂xj ∂xj ∂xi

I Weaken the differentiability requirements by integrating the stress-tensor terms by parts ZZ     ∂ui ∂ui ∂ψi ∂ui ∂uj ∂ψi Re St + uj ψi − p + + dV ∂t ∂xj ∂xi ∂xj ∂xi ∂xj ZZ     ∂ui ∂uj = −pni + + nj ψi dS. ∂xj ∂xi Surface traction Weak form of the Navier–Stokes equation

I Weak form of the momentum equation ZZ     ∂ui ∂ui ∂ψi ∂ui ∂uj ∂ψi Re St + uj ψi − p + + dV ∂t ∂xj ∂xi ∂xj ∂xi ∂xj ZZ     ∂ui ∂uj = −pni + + nj ψi dS. (3) ∂xj ∂xi

I Multiply the continuity equation by a scalar test function, φ, and integrate ZZ ∂u j φ dV = 0. (4) ∂xj

I How do we choose the test functions? I The solution of the Stokes equations satisfies a minimum dissipation theorem:

I Minimise ZZZ     1 ∂ui ∂uj ∂ui ∂uj I (ui ) = + + dV , 4 ∂xj ∂xi ∂xj ∂xi subject to the constraint ∇ · u = 0.

I Introducing a Lagrange multiplier λ leads to the functional ZZZ     1 ∂ui ∂uj ∂ui ∂uj ∂uj J(ui , λ) = + + − λ dV . 4 ∂xj ∂xi ∂xj ∂xi ∂xj

Variational principle for the Stokes equations

I The Stokes equations are the Navier–Stokes equations in the limit Re → 0 ∂p ∂ ∂u ∂u  ∂u 0 = − + i + j and j = 0. ∂xi ∂xj ∂xj ∂xi ∂xj I Introducing a Lagrange multiplier λ leads to the functional ZZZ     1 ∂ui ∂uj ∂ui ∂uj ∂uj J(ui , λ) = + + − λ dV . 4 ∂xj ∂xi ∂xj ∂xi ∂xj

Variational principle for the Stokes equations

I The Stokes equations are the Navier–Stokes equations in the limit Re → 0 ∂p ∂ ∂u ∂u  ∂u 0 = − + i + j and j = 0. ∂xi ∂xj ∂xj ∂xi ∂xj

I The solution of the Stokes equations satisfies a minimum dissipation theorem:

I Minimise ZZZ     1 ∂ui ∂uj ∂ui ∂uj I (ui ) = + + dV , 4 ∂xj ∂xi ∂xj ∂xi subject to the constraint ∇ · u = 0. Variational principle for the Stokes equations

I The Stokes equations are the Navier–Stokes equations in the limit Re → 0 ∂p ∂ ∂u ∂u  ∂u 0 = − + i + j and j = 0. ∂xi ∂xj ∂xj ∂xi ∂xj

I The solution of the Stokes equations satisfies a minimum dissipation theorem:

I Minimise ZZZ     1 ∂ui ∂uj ∂ui ∂uj I (ui ) = + + dV , 4 ∂xj ∂xi ∂xj ∂xi subject to the constraint ∇ · u = 0.

I Introducing a Lagrange multiplier λ leads to the functional ZZZ     1 ∂ui ∂uj ∂ui ∂uj ∂uj J(ui , λ) = + + − λ dV . 4 ∂xj ∂xi ∂xj ∂xi ∂xj I Must be true for all variations and all control volumes, so ∂λ ∂ ∂u ∂u  − + i + j = 0. ∂xi ∂xj ∂xj ∂xi

Variational principle for the Stokes equations

I Minimum is attained when δJ = 0.

I Take variations with respect to ui ZZZ ∂u ∂u  ∂u ∂u i + j δ i − λδ j dV = 0. ∂xj ∂xi ∂xj ∂xj I Must be true for all variations and all control volumes, so ∂λ ∂ ∂u ∂u  − + i + j = 0. ∂xi ∂xj ∂xj ∂xi

Variational principle for the Stokes equations

I Minimum is attained when δJ = 0.

I Take variations with respect to ui ZZZ ∂u ∂u  ∂u ∂u i + j δ i − λδ j dV = 0. ∂xj ∂xi ∂xj ∂xj ZZZ   ∂ ∂ui ∂uj ∂λ ⇒ − + δui + δuj dV = 0. ∂xj ∂xj ∂xi ∂xj I Must be true for all variations and all control volumes, so ∂λ ∂ ∂u ∂u  − + i + j = 0. ∂xi ∂xj ∂xj ∂xi

Variational principle for the Stokes equations

I Minimum is attained when δJ = 0.

I Take variations with respect to ui ZZZ ∂u ∂u  ∂u ∂u i + j δ i − λδ j dV = 0. ∂xj ∂xi ∂xj ∂xj

ZZZ     ∂ ∂ui ∂uj ∂λ ⇒ + − δui dV = 0. ∂xj ∂xj ∂xi ∂xi Variational principle for the Stokes equations

I Minimum is attained when δJ = 0.

I Take variations with respect to ui ZZZ ∂u ∂u  ∂u ∂u i + j δ i − λδ j dV = 0. ∂xj ∂xi ∂xj ∂xj

ZZZ     ∂ ∂ui ∂uj ∂λ ⇒ + − δui dV = 0. ∂xj ∂xj ∂xi ∂xi

I Must be true for all variations and all control volumes, so ∂λ ∂ ∂u ∂u  − + i + j = 0. ∂xi ∂xj ∂xj ∂xi I Must be true for all variations and control volumes, so ∂u j = 0, ∂xj as enforced by the Lagrange multiplier method.

I Velocity and Lagrange multiplier fields satisfy the Stokes equations

∂λ ∂ ∂u ∂u  ∂u − + i + j = 0 and j = 0. ∂xi ∂xj ∂xj ∂xi ∂xj

I Moreover, we identify the pressure as the Lagrange multiplier that enforces the divergence-free constraint.

Variational principle for the Stokes equations

I Take variations with respect to λ ZZZ ∂u j δλ dV = 0. ∂xj I Velocity and Lagrange multiplier fields satisfy the Stokes equations

∂λ ∂ ∂u ∂u  ∂u − + i + j = 0 and j = 0. ∂xi ∂xj ∂xj ∂xi ∂xj

I Moreover, we identify the pressure as the Lagrange multiplier that enforces the divergence-free constraint.

Variational principle for the Stokes equations

I Take variations with respect to λ ZZZ ∂u j δλ dV = 0. ∂xj

I Must be true for all variations and control volumes, so ∂u j = 0, ∂xj as enforced by the Lagrange multiplier method. I Moreover, we identify the pressure as the Lagrange multiplier that enforces the divergence-free constraint.

Variational principle for the Stokes equations

I Take variations with respect to λ ZZZ ∂u j δλ dV = 0. ∂xj

I Must be true for all variations and control volumes, so ∂u j = 0, ∂xj as enforced by the Lagrange multiplier method.

I Velocity and Lagrange multiplier fields satisfy the Stokes equations

∂λ ∂ ∂u ∂u  ∂u − + i + j = 0 and j = 0. ∂xi ∂xj ∂xj ∂xi ∂xj Variational principle for the Stokes equations

I Take variations with respect to λ ZZZ ∂u j δλ dV = 0. ∂xj

I Must be true for all variations and control volumes, so ∂u j = 0, ∂xj as enforced by the Lagrange multiplier method.

I Velocity and Lagrange multiplier fields satisfy the Stokes equations

∂λ ∂ ∂u ∂u  ∂u − + i + j = 0 and j = 0. ∂xi ∂xj ∂xj ∂xi ∂xj

I Moreover, we identify the pressure as the Lagrange multiplier that enforces the divergence-free constraint. I Test functions ψi are associated with velocity.

I Test functions φ are associated with pressure.

I For Galerkin method: Choose ψi to be the fluid velocity basis functions and φ to be the fluid pressure basis functions.

Relating the weak form and variational principle

I Compare the weak form and first variation ZZZ ∂u ∂u  ∂u ∂u ZZZ ∂u i + j δ i −λδ j dV = 0 and j δλ dV = 0. ∂xj ∂xi ∂xj ∂xj ∂xj ZZZ ∂u ∂u  ∂ψ ∂ψ ZZZ ∂u i + j i −p j dV = 0 and j φ dV = 0. ∂xj ∂xi ∂xj ∂xj ∂xj I For Galerkin method: Choose ψi to be the fluid velocity basis functions and φ to be the fluid pressure basis functions.

Relating the weak form and variational principle

I Compare the weak form and first variation ZZZ ∂u ∂u  ∂u ∂u ZZZ ∂u i + j δ i −λδ j dV = 0 and j δλ dV = 0. ∂xj ∂xi ∂xj ∂xj ∂xj ZZZ ∂u ∂u  ∂ψ ∂ψ ZZZ ∂u i + j i −p j dV = 0 and j φ dV = 0. ∂xj ∂xi ∂xj ∂xj ∂xj

I Test functions ψi are associated with velocity.

I Test functions φ are associated with pressure. Relating the weak form and variational principle

I Compare the weak form and first variation ZZZ ∂u ∂u  ∂u ∂u ZZZ ∂u i + j δ i −λδ j dV = 0 and j δλ dV = 0. ∂xj ∂xi ∂xj ∂xj ∂xj ZZZ ∂u ∂u  ∂ψ ∂ψ ZZZ ∂u i + j i −p j dV = 0 and j φ dV = 0. ∂xj ∂xi ∂xj ∂xj ∂xj

I Test functions ψi are associated with velocity.

I Test functions φ are associated with pressure.

I For Galerkin method: Choose ψi to be the fluid velocity basis functions and φ to be the fluid pressure basis functions. I It is very common to choose the vector basis functions to be scalar basis functions in a specific coordinate directions  (ψ , 0, 0) l ≤ N  l u ψl = (0, ψl−Nu , 0) Nu < l ≤ 2Nu  (0, 0, ψl−2Nu ) l > 2Nu

I Choose the test functions in (3) to be the velocity basis and in (4) to be the pressure basis.

I Assemble the set of discrete nonlinear residual equations for the discrete unknowns {ul , pl }.

Finite Elements: The Basic Method

I Approximate velocity and pressure by sums of discrete basis functions

3N Np Xu X u(x, t) = ul (t)ψl (x), p(x, t) = pl (t)φl (x). l=0 l=0 I Choose the test functions in (3) to be the velocity basis and in (4) to be the pressure basis.

I Assemble the set of discrete nonlinear residual equations for the discrete unknowns {ul , pl }.

Finite Elements: The Basic Method

I Approximate velocity and pressure by sums of discrete basis functions

3N Np Xu X u(x, t) = ul (t)ψl (x), p(x, t) = pl (t)φl (x). l=0 l=0

I It is very common to choose the vector basis functions to be scalar basis functions in a specific coordinate directions  (ψ , 0, 0) l ≤ N  l u ψl = (0, ψl−Nu , 0) Nu < l ≤ 2Nu  (0, 0, ψl−2Nu ) l > 2Nu I Assemble the set of discrete nonlinear residual equations for the discrete unknowns {ul , pl }.

Finite Elements: The Basic Method

I Approximate velocity and pressure by sums of discrete basis functions

3N Np Xu X u(x, t) = ul (t)ψl (x), p(x, t) = pl (t)φl (x). l=0 l=0

I It is very common to choose the vector basis functions to be scalar basis functions in a specific coordinate directions  (ψ , 0, 0) l ≤ N  l u ψl = (0, ψl−Nu , 0) Nu < l ≤ 2Nu  (0, 0, ψl−2Nu ) l > 2Nu

I Choose the test functions in (3) to be the velocity basis and in (4) to be the pressure basis. Finite Elements: The Basic Method

I Approximate velocity and pressure by sums of discrete basis functions

3N Np Xu X u(x, t) = ul (t)ψl (x), p(x, t) = pl (t)φl (x). l=0 l=0

I It is very common to choose the vector basis functions to be scalar basis functions in a specific coordinate directions  (ψ , 0, 0) l ≤ N  l u ψl = (0, ψl−Nu , 0) Nu < l ≤ 2Nu  (0, 0, ψl−2Nu ) l > 2Nu

I Choose the test functions in (3) to be the velocity basis and in (4) to be the pressure basis.

I Assemble the set of discrete nonlinear residual equations for the discrete unknowns {ul , pl }. Choosing the basis functions

I Idea: Pick low order polynomials with compact support. I Divide space into elements

I quadrilaterals or triangles (2D) I hexahedrons or tetrahedrons (3D)

I Define elements by a number of nodes xi and insist that ψl (xj ) = δlj .

¡A u u u ¡ uA ¡ A ¡ A u u u ¡ A ¡ A u u u u u Quadratic Quadrilateral Linear Triangle Local coordinates

I Introduce local coordinates, s, within each element.

I Basis functions are easy(ish) in local coordinates.

I Must introduce local node numbering scheme (document it!)

I Must decide on range of local coordiantes, e.g. si ∈ [−1, 1] s2 6 1 ψ0(s1, s2) = 4 s1s2(1 − s1)(1 − s2)

1 2 6u u 7u 8 ψ1(s1, s2) = 2 s2(1 − s1 )(1 − s2) - s1 1 3u 4u u 5 ψ2(s1, s2) = 4 s2s1(1 + s1)(1 − s2) . 0u 1u u 2 .

I Look up common basis functions in books and papers. Weak form of Stokes equations

I In each element we must assemble ZZZ   ZZZ ∂ui ∂uj ∂ψl ∂ψl ∂uj + −p dV = 0 and φl dV = 0. ∂xj ∂xi ∂xj ∂xj ∂xj

I If we use the same scalar basis functions for each velocity component then within the element

N −1 Np−1 Xu X ui (x) = uˆij ψj (s) and p(x) = pˆj φj (s), j=0 j=0

whereu ˆij is the i-th velocity component at the j-th node and pˆj is the j-th pressure unknown. Computing of the unkowns

I Introduction of local coordinates means that we must use the to take spatial derivatives

∂ui X ∂ψl (sk ) X ∂ψl ∂sm = uˆil = uˆil . ∂xj ∂xj ∂sm ∂xj l l

I Computation of the ∂sm/∂xj requires an inversion of the mapping from local to global coordinates xj (sm).

I What is the mapping?

I Idea: Use the same basis functions as the velocity components to describe the mapping from local to global coordinates — an isoparametric mapping. X xi = xˆij ψj (sk ), j

wherex ˆij is the i-th coordinate of the j-th node. Integrating over the element

I Can compute the integrand at any point within the element.

I Integrate using numerical quadrature — a Gauss rule.

Ng Z x2 Z 1 dx X f (x) dx = f (x(s)) ds ≈ w f (s )J(s ). ds ipt ipt ipt x1 −1 ipt=1

0 I J(s) = x (s) is the Jacobian of the mapping from local coordinates to global coordinates.

I The order of the Gauss rule should be chosen so that the is exact for the order of polynomial chosen for the basis functions.

I Look up common Gauss rules in books and papers. Elemental residuals

I Define the residuals for each element   (u) X ∂ui ∂uj ∂ψl Rl,i = (sipt ) + (sipt ) (sipt ) ∂xj ∂xi ∂xj ipt  ∂ψl −p(sipt ) (sipt ) J(sipt )wipt , ∂xi

(p) X ∂uj Rl = (sipt )φl (sipt )J(sipt )wipt , ∂xj ipt

I To assemble loop over all Gauss points, compute the required shape functions and derivatives, Jacobian and add the contribution to each residual. Global Assembly

I We can now assemble the local residuals in each element

I How do we form a global system of equations?

I Loop over all elements and add contributions to the “appropriate” global residuals.

I Need a translation from local node numbers to global node numbers.

I Setting up this translation scheme is the job of the mesh generator.

I Information must be stored somewhere in your program. The global residual problem

I For the 2D Stokes equations, once we have an global numbering for the unknowns, the linear system can be written in the form     K11 K12 C1 u1 R(U) =  K21 K22 C2   u2  = 0. T T C1 C2 0 p

Z ∂ψ ∂ψ Z ∂ψ Kij = ⊗ , dVCi = φ ⊗ dV , ∂xi ∂xj ∂xi

I u1, u2 and p are vectors of global velocity and pressure unknowns.

I ψ and φ are vectors of (global) basis functions arranged in order of the unknowns.

I A linear algebra problem! I Use Newton’s method to find solution Rj (Ui ) = 0 (0) I Assume that we have an initial solution Ui and add a (0) correction δUi to get the exact solution (0) (0) Rj (Ui + δUi ) = 0.

I A Taylor- expansion gives (0) ∂Rj (0) (0) Rj (Ui ) + (Ui ) δUk ≈ 0. ∂Uk I To find correction solve the linear system ∂Ri J δU = −R, where Jij = . ∂Uj

I Converges quadratically for good initial guess (can always start from Re = 0)

Newton’s method for Navier–Stokes

I For Navier–Stokes, get additional term in the momentum equations — nonlinear residuals     K11 + Re N(u) K12 C1 u1 R(U) =  K21 K22 + Re N(u) C2   u2  = 0, T T C1 C2 0 p ZZZ ∂ψ where N(u) = uj ⊗ ψ dV . ∂xj (0) I Assume that we have an initial solution Ui and add a (0) correction δUi to get the exact solution (0) (0) Rj (Ui + δUi ) = 0.

I A Taylor-series expansion gives (0) ∂Rj (0) (0) Rj (Ui ) + (Ui ) δUk ≈ 0. ∂Uk I To find correction solve the linear system ∂Ri J δU = −R, where Jij = . ∂Uj

I Converges quadratically for good initial guess (can always start from Re = 0)

Newton’s method for Navier–Stokes

I For Navier–Stokes, get additional term in the momentum equations — nonlinear residuals     K11 + Re N(u) K12 C1 u1 R(U) =  K21 K22 + Re N(u) C2   u2  = 0, T T C1 C2 0 p ZZZ ∂ψ where N(u) = uj ⊗ ψ dV . ∂xj

I Use Newton’s method to find solution Rj (Ui ) = 0 I A Taylor-series expansion gives

(0) ∂Rj (0) (0) Rj (Ui ) + (Ui ) δUk ≈ 0. ∂Uk

I To find correction solve the linear system

∂Ri J δU = −R, where Jij = . ∂Uj

I Converges quadratically for good initial guess (can always start from Re = 0)

Newton’s method for Navier–Stokes

I Use Newton’s method to find solution Rj (Ui ) = 0 (0) I Assume that we have an initial solution Ui and add a (0) correction δUi to get the exact solution

(0) (0) Rj (Ui + δUi ) = 0. I To find correction solve the linear system

∂Ri J δU = −R, where Jij = . ∂Uj

I Converges quadratically for good initial guess (can always start from Re = 0)

Newton’s method for Navier–Stokes

I Use Newton’s method to find solution Rj (Ui ) = 0 (0) I Assume that we have an initial solution Ui and add a (0) correction δUi to get the exact solution

(0) (0) Rj (Ui + δUi ) = 0.

I A Taylor-series expansion gives

(0) ∂Rj (0) (0) Rj (Ui ) + (Ui ) δUk ≈ 0. ∂Uk Newton’s method for Navier–Stokes

I Use Newton’s method to find solution Rj (Ui ) = 0 (0) I Assume that we have an initial solution Ui and add a (0) correction δUi to get the exact solution

(0) (0) Rj (Ui + δUi ) = 0.

I A Taylor-series expansion gives

(0) ∂Rj (0) (0) Rj (Ui ) + (Ui ) δUk ≈ 0. ∂Uk

I To find correction solve the linear system

∂Ri J δU = −R, where Jij = . ∂Uj

I Converges quadratically for good initial guess (can always start from Re = 0) Newton’s method for Navier–Stokes

I Can assemble local (elemental) Jacobian matrix and residuals

I Loop over all elements and add contributions to global Jacobian matrix and residuals vector.

I Can always approximate J by finite differences. I Equal-order interpolation (ψ = φ) is always a bad choice.

I Weak form indicates that ψ higher differentiability requirements than φ.

I Suggests that ψ should be higher order than φ.

I General theory (inf-sup/LBB stability) exists, but is difficult.

Choice of velocity and pressure basis functions

ZZZ   ∂ui ∂ui ∂uj ∂ψi ∂ψj Re uj ψi + + − p dV = 0 ∂xj ∂xj ∂xi ∂xj ∂xj ZZZ ∂u and j φ dV = 0. ∂xj

I Are we restricted in our choice of basis functions?

I Yes! Only certain combinations of basis functions lead to “good” (stable) elements. I Weak form indicates that ψ higher differentiability requirements than φ.

I Suggests that ψ should be higher order than φ.

I General theory (inf-sup/LBB stability) exists, but is difficult.

Choice of velocity and pressure basis functions

ZZZ   ∂ui ∂ui ∂uj ∂ψi ∂ψj Re uj ψi + + − p dV = 0 ∂xj ∂xj ∂xi ∂xj ∂xj ZZZ ∂u and j φ dV = 0. ∂xj

I Are we restricted in our choice of basis functions?

I Yes! Only certain combinations of basis functions lead to “good” (stable) elements.

I Equal-order interpolation (ψ = φ) is always a bad choice. I General theory (inf-sup/LBB stability) exists, but is difficult.

Choice of velocity and pressure basis functions

ZZZ   ∂ui ∂ui ∂uj ∂ψi ∂ψj Re uj ψi + + − p dV = 0 ∂xj ∂xj ∂xi ∂xj ∂xj ZZZ ∂u and j φ dV = 0. ∂xj

I Are we restricted in our choice of basis functions?

I Yes! Only certain combinations of basis functions lead to “good” (stable) elements.

I Equal-order interpolation (ψ = φ) is always a bad choice.

I Weak form indicates that ψ higher differentiability requirements than φ.

I Suggests that ψ should be higher order than φ. Choice of velocity and pressure basis functions

ZZZ   ∂ui ∂ui ∂uj ∂ψi ∂ψj Re uj ψi + + − p dV = 0 ∂xj ∂xj ∂xi ∂xj ∂xj ZZZ ∂u and j φ dV = 0. ∂xj

I Are we restricted in our choice of basis functions?

I Yes! Only certain combinations of basis functions lead to “good” (stable) elements.

I Equal-order interpolation (ψ = φ) is always a bad choice.

I Weak form indicates that ψ higher differentiability requirements than φ.

I Suggests that ψ should be higher order than φ.

I General theory (inf-sup/LBB stability) exists, but is difficult. Some LBB-stable elements ¡A uhu u h u ×u u ¡ uhA ¡ A ¡ A u u u u ×u × u ¡ u uA ¡ A uhu u h u u u uhu uh Q2Q1 (Taylor–Hood) Q2P−1 P2P1 (Taylor–Hood) Quadratic velocity Quadratic velocity Quadratic velocity Linear pressure Linear pressure Linear pressure

I Pressure need not be continuous between elements.

I Discontinuous pressure leads to load mass conservation because for piecewise constant test function φ ZZZ ZZZ φ∇ · u dV = 0 ⇒ ∇ · u dV = 0. E E Boundary conditions

I Recall the weak form of the Navier–Stokes equations ZZZ     ∂ui ∂ui ∂ψi ∂ui ∂uj ∂ψi Re St + uj ψi − p + + dV ∂t ∂xj ∂xi ∂xj ∂xi ∂xj ZZ     ∂ui ∂uj = −pni + + nj ψi dS, ∂xj ∂xi ZZ ∂u j φ dV = 0. ∂xj

I What are the allowed boundary conditions?

I Specified velocity on boundary. I Specified traction on boundary.

I If the is not included then (implicitly) the traction is set to zero. Example problem: Poiseuille Flow

I Steady flow in channel has parabolic profile, up = (up(y), 0).

I What are appropriate boundary conditions? u = 0

u = 0 Example problem: Poiseuille Flow

I Steady flow in channel has parabolic profile, up = (up(y), 0).

I What are appropriate boundary conditions? u = 0

u = up × p = 0 u = up

u = 0

I Prescribe inlet and outlet velocity

I Dangerous ... must have discretely divergence free boundary conditions.

I Must choose a reference pressure value otherwise problem is underdetermined. I Implicitly sets average pressure to zero. I Implicitly sets average velocity to zero (contradiction).

Example problem: Poiseuille Flow

I Steady flow in channel has parabolic profile, up = (up(y), 0).

I What are appropriate boundary conditions? u = 0

u = up σij nj = 0

u = 0

I Prescribe inlet and leave outlet traction free.

I At outlet Z ∂u Z ∂v ∂u −p + 2 dy = 0, + dy = 0, ∂x ∂x ∂y Example problem: Poiseuille Flow

I Steady flow in channel has parabolic profile, up = (up(y), 0).

I What are appropriate boundary conditions? u = 0

u = up σij nj = 0

u = 0

I Prescribe inlet and leave outlet traction free.

I At outlet Z Z ∂u p dy = 0, dy =u ¯ = 0, ∂y p

I Implicitly sets average pressure to zero. I Implicitly sets average velocity to zero (contradiction). Example problem: Poiseuille Flow

I Steady flow in channel has parabolic profile, up = (up(y), 0).

I What are appropriate boundary conditions? u = 0

u = up v = 0, σxx = 0

u = 0

I Prescribe inlet, set v = 0 and σxx = 0 at outlet

I At outlet Z ∂u Z y2 v = 0, −p + dy = p dy = [v]y2 = 0. y1 ∂x y1

I Here, p = 0 pointwise at the outlet. Example problem: Poiseuille Flow

I Steady flow in channel has parabolic profile, up = (up(y), 0).

I What are appropriate boundary conditions? u = 0

v = 0, v = 0, σxx = P σxx = 0

u = 0

I Prescribe inlet and outlet pressures

I Equivalent to imposing pressure drop.

I Can trade imposed pressure for desired flow rate Q. Example problem: Poiseuille Flow

I Steady flow in channel has parabolic profile, up = (up(y), 0).

I What are appropriate boundary conditions? u = 0

u = 0

I Can prescribe flow rate, pressure drop or velocity profile.

I c.f. Physical experiment. Example Problem: Driven Cavity

I Enclosed flow, so pressure must be specified somewhere.

u = (1, 0)

u = 0 u = 0 Re = 100

u = 0 I Pressure singularities in corners, handled “better” by discontinuous pressure interpolation. Summary of the method for steady flows

I Choose type of element (pick an LBB stable one initially).

I Generate mesh in flow domain. I Specify boundary conditions

I For Dirichlet conditions, replace the discrete weak form. I For traction conditions, assemble the surface integral.

I Loop over elements and assemble the global residuals and Jacobian matrix.

I Solve the (non)linear residual equations using Newton’s method. Unsteady flows

I Need to approximate the time derivative, ∂u/∂t

I No time-derivative of pressure!

I Explicit, or semi-explicit, methods require a projection step (or equivalent) to ensure that the velocity field is divergence free.

I Implicit methods do not, but require the solution of a fully-coupled problem ...

I ... no harder than solving for a steady problem. (In fact, matrices are often better conditioned because of addition of mass matrix to diagonal). Unsteady flows

I Use a second order backward differentiation formula (BDF2) to approximate the time derivative

∂un+1 3un+1 − 4un + un−1 ≈ ∂t 2∆t

n n−1 I Terms involving history values u and u move onto RHS.

I Additional diagonal matrices are mass matrices 3 ZZZ ReSt ψ ⊗ ψ dV . 2∆t

I Assemble and solve just as for steady problem.

I Need additional storage for history values. Summary of the method for unsteady flows

I Choose type of element (pick an LBB stable one initially).

I Choose a timestepper.

I Generate mesh in flow domain. I Specify boundary and initial conditions

I For Dirichlet conditions, replace the discrete weak form. I For traction conditions, assemble the surface integral.

I Loop over elements and assemble the global residuals and Jacobian matrix for each time step

I Solve the (non)linear residual equations using Newton’s method.

I Repeat for as many timesteps as desired.