other cfd methodsgtryggva/cfd-course2010/2010...computational fluid dynamics i! where! and at each...

9
Computational Fluid Dynamics I Other CFD Methods Grétar Tryggvason Spring 2010 http://users.wpi.edu/~gretar/me612.html Computational Fluid Dynamics I Finite Volume Methods are used in the vast majority of CFD codes. However, there are other ways to compute the motion of fluids. Some of the more common alternatives include: Spectral Methods Finite Element Methods Lattice Boltzmann Methods Vortex Methods and other particle methods Here we will briefly examine those Computational Fluid Dynamics I Spectral Methods Computational Fluid Dynamics I Consider the initial-boundary value problem for the one dimensional heat equation By standard technique (Fourier sine transform) the solution is f t = 2 f x 2 0 < x < π, t 0 f (0, t ) = f (π, t ) = 0 f ( x,0) = f ( x) f ( x, t ) = a n (t )sin nx n=1 a n (t ) = f n e n 2 t f n = 2 π f ( x)sin nx dx 0 π Computational Fluid Dynamics I Assuming that the time integration is exact, the error by using only N terms is f f N e N 2 t for all time This is faster than any power of N. Recall that the error for finite difference/finite volume methods is O(h α ) 1 N α Spectral methods are said to have “spectral” or “infinite order” accuracy This property is not retained if the solution has discontinuities Computational Fluid Dynamics I A spectral approximation to the heat equation is now simply f ( x, t ) = a n (t )sin nx n=1 N Sum to N only! Substituting into the heat equation we get: da n dt = n 2 a n ; a n (0) = f n (n = 1,2, N)

Upload: others

Post on 28-Jan-2021

5 views

Category:

Documents


0 download

TRANSCRIPT

  • Computational Fluid Dynamics I

    Other!CFD Methods!

    Grétar Tryggvason!Spring 2010!

    http://users.wpi.edu/~gretar/me612.html!Computational Fluid Dynamics I

    Finite Volume Methods are used in the vast majority of CFD codes. However, there are other ways to compute the motion of fluids. Some of the more common alternatives include:!

    Spectral Methods!Finite Element Methods!Lattice Boltzmann Methods!Vortex Methods and other particle methods!

    Here we will briefly examine those!

    Computational Fluid Dynamics I

    Spectral !

    Methods!

    Computational Fluid Dynamics I

    Consider the initial-boundary value problem for the one dimensional heat equation!

    By standard technique (Fourier sine transform) the solution is!

    ∂f∂t

    = ∂2 f

    ∂x 20 < x < π, t ≥ 0

    f (0,t) = f (π,t) = 0f (x,0) = f (x)

    f (x, t) = an (t)sinnxn=1

    ∑an (t) = fne

    −n 2t

    fn =2π

    f (x)sinnx dx0

    π∫

    Computational Fluid Dynamics I

    Assuming that the time integration is exact, the error by using only N terms is!

    f − fN ≈ e−N 2t for all time!

    This is faster than any power of N. Recall that the error for finite difference/finite volume methods is!

    O(hα ) ≈ 1N α

    Spectral methods are said to have “spectral” or “infinite order” accuracy!This property is not retained if the solution has discontinuities!

    Computational Fluid Dynamics I

    A spectral approximation to the heat equation is now simply!

    f (x, t) = an (t)sinnxn=1

    N

    ∑ Sum to N only!!

    Substituting into the heat equation we get:!

    dandt

    = −n2an; an (0) = fn (n =1,2,…N)

  • Computational Fluid Dynamics I

    For nonlinear equations the use of spectral methods becomes much more involved!

    ∂f∂t

    + f ∂f∂x

    = ν ∂2 f∂x 2

    Expand the solution in a Fourier series!

    f (x,t) = ak (t)e−i 2π

    Lkx

    |k|

  • Computational Fluid Dynamics I

    Ni(1) = x − xi−1

    Δxi; Ni−1

    (1) = xi − xΔxi

    Ni(2) = xi+1 − x

    Δxi+1; Ni+1

    (2) = x − xiΔxi+1

    For element 2:!

    For element 1:!

    i

    i +1

    i −1�

    Ni(1)

    Ni−1(1)

    Ni(2)

    Ni+1(2)

    Linear basis functions!

    element 1! element 2!

    Computational Fluid Dynamics I

    ∂Ni(1)

    ∂x= 1Δxi

    ; ∂Ni−1(1)

    ∂x= −1Δxi

    Ni(1) = x − xi−1

    Δxi; Ni−1

    (1) = xi − xΔxi

    Ni(2) = xi+1 − x

    Δxi+1; Ni+1

    (2) = x − xiΔxi+1

    For element 2:!

    For element 1:!

    ∂Ni(2)

    ∂x= −1Δxi+1

    ; ∂Ni+1(2)

    ∂x= 1Δxi+1

    Computational Fluid Dynamics I

    Example: Elliptic Problem!

    ∂∂x

    k ∂f∂x

    ⎛ ⎝ ⎜

    ⎞ ⎠ ⎟ = q

    R = ∂∂x

    k ∂f∂x

    ⎛ ⎝ ⎜

    ⎞ ⎠ ⎟ − q

    W (x)R(x)dxΩ∫ = 0

    W ∂∂x

    k ∂f∂x

    ⎛ ⎝ ⎜

    ⎞ ⎠ ⎟ dx

    Ω∫ = qWdxΩ∫

    The residual is:!

    The weighted residual is:!

    Or:!

    W(x): Weighting function!

    Computational Fluid Dynamics I

    Integrate by parts!

    W ∂∂x

    k ∂f∂x

    ⎛ ⎝ ⎜

    ⎞ ⎠ ⎟ dx

    Ω∫ = qWdxΩ∫

    k ∂f∂x

    ⎛ ⎝ ⎜

    ⎞ ⎠ ⎟ ∂W∂x

    dxΩ∫ +

    ∂∂xW k ∂f

    ∂x⎛ ⎝ ⎜

    ⎞ ⎠ ⎟ dx

    Ω∫ = qWdxΩ∫

    k ∂f∂x

    ⎛ ⎝ ⎜

    ⎞ ⎠ ⎟ ∂W∂x

    dxΩ∫ + W k

    ∂f∂x

    ⎛ ⎝ ⎜

    ⎞ ⎠ ⎟

    ⎡ ⎣ ⎢

    ⎤ ⎦ ⎥ 2− W k ∂f

    ∂x⎛ ⎝ ⎜

    ⎞ ⎠ ⎟

    ⎡ ⎣ ⎢

    ⎤ ⎦ ⎥ 1

    = qWdxΩ∫

    Evaluating the second term:!

    Cancel for adjacent elements!

    Computational Fluid Dynamics I

    Galerkin Method!Take weighting function equal to the interpolation function!

    f x( ) = f I NI x( )I∑

    k ∂ f∂x

    ⎛⎝⎜

    ⎞⎠⎟∂W∂x

    dxΩ∫ = qW dxΩ∫

    For node i:!

    f jj= i−1

    i+1

    ∑ k ∂N j∂xi−1i+1

    ∫∂Ni∂x

    dx − qNi (x)i−1

    i+1

    ∫ dx = 0

    ∂Ni(1)

    ∂x= 1Δxi

    ;

    ∂Ni−1(1)

    ∂x= −1Δxi

    ∂Ni(2)

    ∂x= −1Δxi+1

    ∂Ni+1(2)

    ∂x= 1Δxi+1

    Computational Fluid Dynamics I

    f jj= i−1

    i+1

    ∑ k ∂N j∂xi−1i+1

    ∫∂Ni∂x

    dx − qNi (x)i−1

    i+1

    ∫ dx = 0

    ki+1/2fi+1 − fiΔx2

    − ki−1/2fi − fi−1Δx2

    −qi−1 + 4qi + qi+1

    6= 0

    ki+1/2 =1Δx

    ki

    i+1

    ∫ dx

    integrating!

    where! Notice that a finite difference method would give the same result except with qi on the RHS! �

    ∂Ni(1)

    ∂x= 1Δxi

    ;

    ∂Ni−1(1)

    ∂x= −1Δxi

    ∂Ni(2)

    ∂x= −1Δxi+1

    ∂Ni+1(2)

    ∂x= 1Δxi+1

  • Computational Fluid Dynamics I

    Finite Element approximation of an unsteady problem:!

    ∂f∂t

    +U ∂f∂x

    = 0

    f x( ) = f I NI x( )I∑�

    ∂f∂tW dx

    Ω∫ + U ∂f∂xW dxΩ∫

    = 0

    Weak formulation!

    Introduce the finite element representation!

    Computational Fluid Dynamics I

    f x( ) = f I NI x( )I∑

    ∂f∂tW dx

    Ω∫ + U ∂f∂xW dxΩ∫

    = 0

    Introduce the finite element representation!

    ∂f I∂tI

    ∑ NINJ dxΩ∫ +U NI dNJdx dxΩ∫

    = 0

    or!

    ∂f I∂t

    MIJ +U KIJI∑ = 0

    I∑

    MIJ = NINJ dxΩ∫ ; KIJ = NI dNJdx dxΩ∫

    ;

    “Mass matrix”! “Stiffness matrix”!

    Computational Fluid Dynamics I

    The mass matrix makes it complex to use simple explicit time integrators. This can be overcome by “lumping” the matrix!

    Computational Fluid Dynamics I

    In two-dimensions triangular (or tedrahedron) elements are frequently used!

    Computational Fluid Dynamics I

    Lattice Boltzmann Methods!

    Computational Fluid Dynamics I

    Lattice Boltzmann methods use “particles” on hexagonal grids where the particles move according to discrete rules. It can be shown that the macroscopic motion of the particles resembles the Navier-Stokes equations. It is now believed that these methods can yield results comparable in accuracy to other numerical methods!

    Lattice Boltzmann methods !

  • Computational Fluid Dynamics I

    where!

    and at each node!

    e1�

    e2

    e5

    e6

    e3

    e7

    e4

    e8

    Update the velocity distributions at each node by:!

    ∂ fγ∂t

    + eγ ⋅∇fv =1ετ

    fγ(eq) − fγ( ), γ = 0,1,,M

    ρ = fγγ =1

    M

    ∑ ρu = fγγ =1

    M

    ∑ eγ

    fγ(eq) = wγ ρ 1+ 3 eγ ⋅u( ) + 92 eγ ⋅u( )

    2−32u ⋅u( )2⎡

    ⎣⎢⎤⎦⎥

    Lattice Boltzmann methods !Computational Fluid Dynamics I

    Δt = Δx = Δy = ε

    α = Δt eγ Δx ; β = Δx ε

    fγ x,t + Δt( ) − fγ x,t( ) = −α fγ x,t( ) − fγ x −Δteγ ,t( )( )− βτ

    fγ x −Δteγ ,t( ) − fγ(eq ) x −Δteγ ,t( )( )where!

    taking! And replacing!

    fγ x + Δteγ ,t + Δt( ) − fγ x,t( ) = 1τ fγ(eq ) x,t( ) − fγ x,t( )( )

    ∂fγ∂t

    + eγ ⋅ ∇fv =1ετ

    fγ(eq ) − fγ( ), γ = 0,1,,M

    Approximate the time derivative by a first order forward in time, the advection term by upwind and the collision by downwind, we get!

    Δx = Δt eγ

    x + Δteγ yields!by!

    x

    Lattice Boltzmann methods !

    Computational Fluid Dynamics I

    Δt = Δx = Δy = ε

    α = Δt eγ Δx ; β = Δx ε

    fγ x,t + Δt( ) − fγ x,t( ) = −α fγ x,t( ) − fγ x −Δteγ ,t( )( ) − βτ fγ x −Δteγ ,t( ) − fγ(eq ) x −Δteγ ,t( )( )

    Set!

    taking!

    Replace!

    fγ x + Δteγ ,t + Δt( ) − fγ x,t( ) = 1τ fγ(eq ) x,t( ) − fγ x,t( )( )

    Δx = Δt eγ

    x + Δteγby!

    x

    fγ x + Δteγ ,t + Δt( ) − fγ x + Δteγ ,t( ) = −Δt eγΔx

    fγ x + Δteγ ,t( ) − fγ x,t( )( ) − Δt eγετ fγ x,t( ) − fγ(eq ) x,t( )( )

    And crossing out the common term yields!

    Proof!Lattice Boltzmann methods !

    Computational Fluid Dynamics I

    eγ =ΔxΔt

    cos π2

    ⎛⎝⎜

    ⎞⎠⎟γ −1( ),sin π

    2⎛⎝⎜

    ⎞⎠⎟γ −1( )⎛

    ⎝⎜⎞⎠⎟, γ = 1,3,5,7

    eγ = 2ΔxΔt

    cos π2

    ⎛⎝⎜

    ⎞⎠⎟γ −1( ) + π

    4,sin π

    2⎛⎝⎜

    ⎞⎠⎟γ −1( ) + π

    4⎛⎝⎜

    ⎞⎠⎟, γ = 2,4,6,8

    e0 = 0

    w0 = 0wγ = 4 9 γ = 1,3,5,7wγ = 1 36 v = 2,4,6,8 �

    e1�

    e2

    e5

    e6

    e3

    e7

    e4

    e8

    The weights must be taken to be!

    The displacement vectors are!

    Lattice Boltzmann methods !

    Computational Fluid Dynamics I

    e1�

    e2

    e5

    e6

    e3

    e7

    e4

    e8

    fγ x + Δteγ ,t + Δt( ) − fγ x,t( ) = 1τ fγ(eq ) x,t( ) − fγ x,t( )( )

    ρ = fγγ =1

    M

    ρu = fγγ =1

    M

    ∑ eγ�

    fγ(eq ) = wγ ρ 1+ 3 eγ ⋅u( ) + 92 eγ ⋅u( )

    2− 32u ⋅u( )2⎡ ⎣ ⎢

    ⎤ ⎦ ⎥

    where!

    and at each node!

    Update the velocity distributions at each node by:!Summary:!

    Lattice Boltzmann methods !Computational Fluid Dynamics I

    Lattice Boltzmann methods !

    Advantages!

    Very easy to program–parallelization easy!

    Fast–in part because incompressibility is not enforced!

    Disadvantages!

    Difficult to implement new physics—must find a discrete equation that corresponds to the new physics!

    The flow is not completely incompressible!

  • Computational Fluid Dynamics I

    Lattice Boltzmann methods !

    By now it is understood that LBM are give results comparable to second order finite difference/volume methods!

    LBM has been extended to more complex flow, including multiphase flows with sharp interfaces!

    The figure shows a comparison of the unsteady rise of a buoyant bubble computed by LBM (left) and front tracking finite volume method (right).!

    From: K. Sankaranarayanan, I.G. Kevrekidis, S. Sundaresan , J. Lu, G. Tryggvason. A comparative study of lattice Boltzmann and front-tracking finite-difference methods for bubble simulations. Int. J. Multiphase Flow 29 (2003) 109–116.!

    Computational Fluid Dynamics I

    Particle Methods!

    Computational Fluid Dynamics I

    Particle methods cover a large range of physical situations, some overlapping with more conventional methods. Particle methods include:!

    !Point vortex/vortex blob methods!

    !Particle-in-Cell codes!!Smoothed particle hydrodynamics!!Dissipative particle methods!!Molecular dynamics!!and many more!

    In many cases a grid is used also, either for efficiency or to account for some of the physics!

    Computational Fluid Dynamics I

    Vortex Methods!

    Computational Fluid Dynamics I

    ∇2φ = σSolution to!

    The solution in a two-dimensional unbounded domain is!

    φ(x) = 12π

    σ (x')ln rda'A∫

    The solution in a three-dimensional unbounded domain is!

    φ(x) = −14π

    σ (x')r

    dv 'A∫

    r = x − x'

    Vortex Methods!Computational Fluid Dynamics I

    u x( ) = −∂ψ∂y,∂ψ∂x

    ⎝ ⎜

    ⎠ ⎟ =

    −12π

    ω(x') −∂ ln r∂y

    ,∂ ln r∂x

    ⎝ ⎜

    ⎠ ⎟ da'A∫�

    ∇2ψ = −ω

    ∂ ln r∂y

    = ∂∂yln (x − x ')2 + (y − y ')2( ) = (y − y ')(x − x')2 + (y − y')2�

    u x( ) = −12π

    ω(x') −(y − y '),(x − x ')( )r2

    da'A∫

    ψ(x) = −12π

    ω(x')ln rda'A∫Solution!

    Velocity!

    since!

    Vortex Methods!

  • Computational Fluid Dynamics I

    ∇2ψ = −ω

    Euler Equation for two-dimensional inviscid incompressible flow!

    dωdt

    = 0

    u = ∇ × (ψk)

    u x( ) = 12π

    KA∫ x,x'( )ω x'( )dA'

    where K is the appropriate velocity kernal!

    The vorticity of each material particle is constant!

    Vortex Methods!Computational Fluid Dynamics I

    K x,x'( ) = k × x − x'( )x − x' 2

    = (−(y − y '),(x − x'))r2

    For unbounded domain!�

    u x( ) = 12π

    KA∫ x,x'( )ω x'( )dA'

    The velocity depends only on the vorticity distribution!

    Vortex Methods!

    Computational Fluid Dynamics I

    u x( ) = 12π

    KA∫ x,x'( )ω x'( )dA'

    = 12π

    K x,x'( )ω x'( )dA'A j∫

    j=1

    N

    = 12π

    K x,x'( ) ω x'( )dA'A j∫

    j=1

    N

    = 12π

    K x,x'( )Γ jj=1

    N

    ∑�

    x

    x'j

    x'j�

    x'j

    δ

    Vortex Methods!Computational Fluid Dynamics I

    dxidt

    = 12π

    K xi ,x j( )Γ jj=1

    N

    ddt(xi,yi) =

    12π

    Γ j (−(yi − y j ),(xi − x j ))(xi − x j )

    2 + (yi − y j )2

    j=1j≠ i

    N

    Point vortices in an unbounded domain. The motion of each point is determined by !

    Vortex Methods!

    Computational Fluid Dynamics I

    Use point vortices to approximate a smooth distribution of vorticity !

    Vortex Methods!Computational Fluid Dynamics I

    ddt(xi,yi) =

    12π

    Γ j (−(yi − y j ),(xi − x j ))(xi − x j )

    2 + (yi − y j )2 + δ 2j=1

    N

    Generally, the point vorticies are too singular to make a practical numerical method and the point vortices must be regularized. The simplest way is to find the velocity by !

    Numerical parameter !

    Vortex Methods!

  • Computational Fluid Dynamics I

    Small viscosity can be added to vortex methods either by “random walk” or localized averaging!

    In three-dimension it is necessary to account also for stretching and tilting of vortex lines, but the basic methodology still works!

    Vortex Methods!Computational Fluid Dynamics I

    High Reynolds number density current!

    Example!

    Vortex Methods!

    Computational Fluid Dynamics I

    The N2 problem:!To find the velocity of each vortex, it is necessary to sum over all the other vortices. This leads to large computational times when the number of vortices, N, is large!

    Remedies:!Grid based Vortex-In-Cell methods!Fast summation methods!

    Vortex Methods!Computational Fluid Dynamics I

    Vortex-In-Cell!

    Advect point vortices, but solve !

    ∇2ψ = −ωto find the velocities!

    Vortex Methods!

    Computational Fluid Dynamics I

    Fast summation method!

    A vortex far away from a group of vortices “sees” the group as a single large vortex!

    By grouping the vortices together in an intelligent way, it is possible to reduce the operation count significantly !

    Vortex Methods!Computational Fluid Dynamics I

    Related Methods!

    !Panel and boundary integral !! !method for flow over solid bodies!!Boundary Integral Methods for free !! !surface flows!!Contour dynamics methods for “patches”!! !of constant vorticity!

    Vortex Methods!

  • Computational Fluid Dynamics I

    For more information:!

    Vortex Methods: Theory and Applications by Georges-Henri Cottet & Petros D. Koumoutsakos !

    Vortex Methods!Computational Fluid Dynamics I

    Other Particle Methods!

    Smooth Particle Hydrodynamics: the fluid mass is lumped into smoothed blobs that are moved using Newtonʼs second law directly, without an underlying mesh!

    Dissipative Particles Dynamics: particles represents molecules or fluid blobs but while the method has similarities with SPH, it is generally used to model mesoscale behavior of complex fluids and more liberties are taken in modeling the interactions of the particles!

    Molecular Dynamics: Not really a CFD technique but can be used to simulate small (really small) fluid regions!

    Computational Fluid Dynamics I

    There is no doubt that new solution strategies will continue to be developed. However, incremental advances of current approaches are likely to be the main vehicle for future advances in the computations of complex flows. The finite volume approach currently at the core of CFD has, in particular, proven to be exceedingly robust and versatile.!