FMIA F. Moukalled L. Mangani M. Darwish An Advanced Introduction with OpenFOAM and Matlab This textbook explores both the theoretical oundation o the Finite Volume Method (FVM) and its applications in omputational Fluid Dynamics (FD). Readers will discover a thorough explanation o the FVM numerics and algorithms used in the simulation o incompressible and compressible luid lows, along with a detailed examination o the components needed or the development o a collocated unstructured pressure-based FD solver. Two particular FD codes are explored. The irst is ufvm, a three-dimensional unstructured pressure-based inite volume academic FD code, implemented within Matlab. The second is OpenFOAM, an open source ramework used in the development o a range o FD programs or the simulation o industrial scale low problems. Moukalled Mangani Darwish Fluid Mechanics and Its Applications 3 Series Editor: A. Thess The Finite Volume Method in omputational Fluid Dynamics With over 22 igures, numerous examples and more than one hundred exercises on FVM numerics, programming, and applications, this textbook is suitable or use in an introductory course on the FVM, in an advanced course on FD algorithms, and as a reerence or FD programmers and researchers. Fluid Mechanics and Its Applications F. Moukalled L. Mangani M. Darwish The Finite Volume Method in omputational Fluid Dynamics The Finite Volume Method in omputational Fluid Dynamics An Advanced Introduction with OpenFOAM and Matlab Engineering ISBN 978-3-39-6873-9 9 78339 68739 Discretization o the onvection Term hapter 2
( ρv) + ( ρvv) = τ + B t ( ) t ρe ( ρα ) + ( ρvα ) = t onvection Term + ( ρve) = ( vp) + ( v τ ) + Q ( ρα) + ( ρvα) = t Transient-like Term Pressure orrection Equation ( ρφ) + ( ρvφ) = ( Γ φ) + Q t Fluid 4 Fluid 2 Fluid Fluid 3 Ω ρ Δt ( ) + ρ U * P P ( P ) ρ * D P ( ( ) S ) Advection-like Term account or compressibility eects = Ω ρ * o P ρ P Δt ( ) + ρ * * ( U ) ( ρ v S ) ρ * H v ( [ ] S ) The simplicity o the convection term does not extend to its discretization (3 decades o research and continuing)
High Order Schemes
Notation WW W P E EE e WW W P E EE e WW W P E EE e v UU U D DD v DD D U UU
onvection Schemes ϕ ϕ DOWNWIND ϕ ϕ D ϕ U UU U D DD UU U D DD v v ENTRAL ϕ ϕ ϕ D QUIK ϕ U ϕ ϕ ϕ D UU U D DD UU U D DD v v SOU ϕ ϕ ϕ U UU U D DD v
onvection Schemes onvection Scheme ENTRAL SOU (Second Order Upwind) QUIK (Quadratic Upwind Interpolation or onvective Kinematics) DOWNWIND Formula = = + 2 = 3 2 2 φ U = 3 4 + 3 8 φ U 8 =
onvection Discretization m (δx) w (δx) e NW N NE Φ= (δy) n S n m v(2,) S w S e W P E ( y) P Φ= (δy) s S s Φ= SW S SE ( ) = ρvφ ρvφ ( ) S = = nb(p ) ( x) P ( ρ e v e S e )φ e + ( ρ w v w S w )φ w + ( ρ n v n S n )φ n + ( ρ s v s S s )φ s =
Second -Order Upwind,SOU = 3 2 φ 2 φ U ( ρ e v e S e )φ e = ρ e v e S e ( ρ w v w S w )φ w = ρ w v w S w ( ρ e v e S e ) 3 2 φ P 2 φ W + ( ρ n v n S n ) 3 2 φ P 2 φ S + a P φ P + a P = ( ) 3 2 φ P 2 φ W ( ) 3 2 φ W 2 φ WW a N φ N = N = E,W,N,S,WW,SS,NN,SS a N N = E,W,N,S,EE,WW,NN,SS ( ρ w v w S w ) 3 2 φ W 2 φ WW + ( ρ s v s S s ) 3 2 φ S 2 φ SS = y ( δ y) n ( δ y) s NW W SW a W = 3 ( 2 ρ wv w S w ) ( 2 ρ ev e S e ) a S = 3 ( 2 ρ v S s s s ) ( 2 ρ v S n n n ) a E = a N = a EE = a NN = ( δ x) w ( δ x) e S w w x N S n S n s S s ( Δx) e S e NE E SE a WW = ( 2 ρ wv w S w ) a SS = ( 2 ρ sv s S s ) ( Δy)
Deerred orrection ( ρvφ SOU ) S = NW ( δ x) w ( δ x) e N NE ( ρ v S )(,SOU +,, ) = = nb(p ) ( ρ v S ), = ρ v S = nb(p ) a P φ P + N = NB(P ) a N φ N = nb(p ) ( )(,SOU, ) = b P dc y ( δ y) n ( δ y) s W SW S w w S n S n s S s ( Δx) e S e E SE ( Δy) x
Unstructured Grids D V U d PN P N3 P N 3 φ U = 2r D N N2 N N 2 S N2 U V D
Unstructured Grid onvection Scheme ENTRAL SOU (Second Order Upwind) QUIK (Quadratic Upwind Interpolation or onvective Kinematics) DOWNWIND Formula no change = + r = + ( 2 ) r = + ( 2 + ) r no change
DOWNWIND Numerical Dispersion Numerical Diusion Numerical Dispersion SOU SMART 3/4 ENTRAL /4 FROMM SUDS NVF-SUDS STOI
omputing the Gradient φ dv = φ ds V V N 2 2 φ V = V φ dv P S N N 3 3 φ P = V P V P S N 4 4 φ P = V P = nb(p ) S
Gradient at the ell Face F 2 P F F 3 F 4 F 2 F 3 P F = ( e dc )e dc + φ d D e dc F 4
Gradient Formulation o HO schemes QUIK SOU ENTRAL = + 2 = + 2 = + 2 = + 4 2 + φ U 8 + φ U 8 + φ U + 8 φ U 8 = + ( 2 + ) r = 3 2 2 φ U = + φ U 2 = + φ U 2 2 = + ( 2 ) r = + 2 = + 2 = + r
Gradient Form o Schemes onvection Scheme ENTRAL SOU (Second Order Upwind) QUIK (Quadratic Upwind Interpolation or onvective Kinematics) DOWNWIND Formula no change = + r = + ( 2 φ ) r = + ( 2 + φ ) r no change
High Resolution Schemes
-Normalization Procedure!φ = φ φ U φ U φ U φ U φ U φ U v UU U D DD v DD D U UU φ U φ U φ U φ U φ U = < = φ U = > = φ U = = = φ U = = =
Normalized HO Schemes! = φ U φ U DW SOU FROMM QUIK! = D 3/4 3/8 /4 Scheme Formula Normalized!φ U = ENTRAL SOU (Second Order Upwind) = = + 2 = = + 2 2 = 3 2 φ 2 φ U = 3 2! = φ U φ U QUIK (Quadratic Upwind Interpolation or DOWNWIND = 3 4 + 8 3 8 = 3 + 4 8 = =
2-B riteria DW 3/4! = φ u φ n ( φ! ) continuous ( φ! )= i φ! =! < ( φ! )< < φ! < ( φ! )= i φ! = v ( φ! )= φ! i φ! < or φ! > min( φ NB, ) max( φ NB, ) φ n+ n i = H φ i k H φ j n,φ n n ( i k+,,φ i+k ) j [ i k,i + k ] Boundedness riteria Flux Limiter (TVD) Positiveness
The Normalized Variable Diagram! = DOWNWIND!! = 3 2 SOU! =! + 3 SMART! = 3 4! + 3 8! = 2! + 2 BOUNDED MINMOD SMART OSHER STOI MUSLD 3/4! =! 3/4 ENTRAL /4 /4 FROMM
Bounded HR Schemes MINMOD BOUNDED D OSHER 3/4 3/4 3/4 /4 /4 /4 SMART STOI MUSL 3/4 3/4 3/4 /4 /4 /4
Implementation φ P,φ N,φ N2,φ N3 SMART 4 ( )! =! 3/4 d PN N P N3 N2 P N 3 N N 2 S N2 /4 3 2 φ P φ N φ U φ P 2r PN! = φ U φ U 5 (! )( φ U ) +φ U
Deerred orrection ( ρ v ) S =!m = ( ) =nb P ( ) =nb P ρ v φ SMART SMART S = ( ρ v S ) SMART!m φ =!m φ +!m " $ # %$ φ SMART " $$$ # $$$ % =nb( P) a P φ P + ( ) =nb P implicit ( ) =nb P ( ) deerred a F φ F = b P!m φ SMART " $$$ # $$$ % ( ) F=NB P =!m SMART =!m φ " $ # %$ +!m φ SMART " $$$ # $$$ % treat implicitly ( ) ( ) =nb P treat explicitly ( ) deerred a P φ P + ( ) F=NB P a F φ F = b P + b P dc SMART
DOWNWIND Numerical Dispersion Numerical Diusion Numerical Dispersion SOU SMART 3/4 ENTRAL /4 FROMM SUDS φ.5 EXAT MINMOD OSHER TVD-MUSL SUPERBEE BJ-MUSL.5 X NVF-SUDS STOI
HR Schemes