Finite Volume Method An Introduction Praveen. C CTFD Division National Aerospace Laboratories Bangalore 560 037 email: praveen@cfdlab.net April 7, 2006 Praveen. C (CTFD, NAL) FVM CMMACS 1 / 65
Outline Divergence theorem 1 Conservation laws 2 3 Convection-diffusion equation FVM in 1-D 4 Stability of numerical scheme 5 Non-linear conservation law 6 Grids and finite volumes 7 FVM in 2-D 8 Summary 9 10 Further reading Praveen. C (CTFD, NAL) FVM CMMACS 2 / 65
Outline Divergence theorem 1 Conservation laws 2 3 Convection-diffusion equation FVM in 1-D 4 Stability of numerical scheme 5 Non-linear conservation law 6 Grids and finite volumes 7 FVM in 2-D 8 Summary 9 10 Further reading Praveen. C (CTFD, NAL) FVM CMMACS 3 / 65
Divergence theorem In Cartesian coordinates, � q = ( u , v , w ) q = ∂ u ∂ x + ∂ v ∂ y + ∂ w ∇ · � ∂ z Divergence theorem dV n � � ∇ · � � q · ˆ q d V = n d S V V ∂ V Praveen. C (CTFD, NAL) FVM CMMACS 4 / 65
Outline Divergence theorem 1 Conservation laws 2 3 Convection-diffusion equation FVM in 1-D 4 Stability of numerical scheme 5 Non-linear conservation law 6 Grids and finite volumes 7 FVM in 2-D 8 Summary 9 10 Further reading Praveen. C (CTFD, NAL) FVM CMMACS 5 / 65
Conservation laws Basic laws of physics are conservation laws: mass, momentum, energy, charge Control volume n Streamlines Rate of change of φ in V = -(net flux across ∂ V ) ∂ � � � F · ˆ φ d V = − n d S ∂ t V ∂ V Praveen. C (CTFD, NAL) FVM CMMACS 6 / 65
Conservation laws If � F is differentiable, use divergence theorem ∂ � � ∇ · � φ d V = − F d V ∂ t V V or � � ∂φ � ∂ t + ∇ · � F d V = 0 , for every control volume V V ∂φ ∂ t + ∇ · � F = 0 In Cartesian coordinates, � F = ( f , g , h ) ∂φ ∂ t + ∂ f ∂ x + ∂ g ∂ y + ∂ h ∂ z = 0 Praveen. C (CTFD, NAL) FVM CMMACS 7 / 65
Differential and integral form Differential form ∂φ ∂ t + ∇ · � F = 0 ∂ ∂ t (conserved quantity) + divergence(flux) = 0 Integral form ∂ � � � F · ˆ φ d V = − n d S ∂ t ∂ V V Praveen. C (CTFD, NAL) FVM CMMACS 8 / 65
Mass conservation equation φ = ρ , � F = ρ� q � F · ˆ n d S = amount of mass flowing across d S per unit time ∂ � � ρ� q · ˆ ρ d V + n d S = 0 ∂ t V ∂ V Using divergence theorem ∂ � � ∇ · ( ρ� ρ d V + q ) d S = 0 ∂ t V V or � ∂ρ � � ∂ t + ∇ · ( ρ� q ) d V = 0 V Praveen. C (CTFD, NAL) FVM CMMACS 9 / 65
Mass conservation equation Differential form ∂ρ ∂ t + ∇ · ( ρ� q ) = 0 In Cartesian coordinates, � q = ( u , v , w ) ∂ρ ∂ t + ∂ ∂ x ( ρ u ) + ∂ ∂ y ( ρ v ) + ∂ ∂ z ( ρ w ) = 0 Non-conservative form ∂ρ ∂ t + u ∂ρ ∂ x + v ∂ρ ∂ y + w ∂ρ � ∂ u ∂ x + ∂ v ∂ y + ∂ w � ∂ z + ρ = 0 ∂ z or in vector notation ∂ρ ∂ t + � q · ∇ ρ + ρ ∇ · � q = 0 Praveen. C (CTFD, NAL) FVM CMMACS 10 / 65
Navier-Stokes equations ∂ρ ∂ t + ∇ · ( ρ� Mass: q ) = 0 ∂ ∂ t ( ρ� q ) + ∇ · ( ρ� q � q ) + ∇ p = ∇ · τ Momentum: q · τ ) + ∇ · � ∂ E ∂ t + ∇ · ( E + p ) � = ∇ · ( � q Q Energy: Praveen. C (CTFD, NAL) FVM CMMACS 11 / 65
Convection and diffusion ∂ρ ∂ t + ∇ · ( ρ� Mass: q ) = 0 ∂ ∂ t ( ρ� q ) + ∇ · ( ρ� q � q ) + ∇ p = ∇ · τ Momentum: q · τ ) + ∇ · � ∂ E ∂ t + ∇ · ( E + p ) � = ∇ · ( � q Q Energy: Praveen. C (CTFD, NAL) FVM CMMACS 12 / 65
Outline Divergence theorem 1 Conservation laws 2 3 Convection-diffusion equation FVM in 1-D 4 Stability of numerical scheme 5 Non-linear conservation law 6 Grids and finite volumes 7 FVM in 2-D 8 Summary 9 10 Further reading Praveen. C (CTFD, NAL) FVM CMMACS 13 / 65
Convection-diffusion equation Convection-diffusion equation ∂ x = µ∂ 2 u ∂ u ∂ t + a ∂ u ∂ x 2 a , µ are constants, µ > 0 Conservation law form ∂ u ∂ t + ∂ f = 0 ∂ x f c + f d = f f c = au − µ∂ u f d = ∂ x Praveen. C (CTFD, NAL) FVM CMMACS 14 / 65
Convection equation Scalar convection equation ∂ u ∂ t + a ∂ u ∂ x = 0 Exact solution u ( x , t + ∆ t ) = u ( x − a ∆ t , t ) Wave-like solution: convected at speed a Wave moves in a particular direction Solution can be discontinuous Hyperbolic equation Praveen. C (CTFD, NAL) FVM CMMACS 15 / 65
Scalar convection equation a > 0 t Praveen. C (CTFD, NAL) FVM CMMACS 16 / 65
Scalar convection equation a > 0 a ∆ t ∆ t t t+ Praveen. C (CTFD, NAL) FVM CMMACS 17 / 65
Convection equation Scalar convection equation ∂ u ∂ t + a ∂ u ∂ x = 0 Exact solution u ( x , t + ∆ t ) = u ( x − a ∆ t , t ) Wave-like solution: convected at speed a Wave moves in a particular direction Solution can be discontinuous Hyperbolic equation Praveen. C (CTFD, NAL) FVM CMMACS 18 / 65
Diffusion equation Scalar diffusion equation ∂ t = µ∂ 2 u ∂ u ∂ x 2 Solution u ( x , t ) ∼ e − µ k 2 t f ( x ; k ) Solution is smooth and decays with time Elliptic equation Praveen. C (CTFD, NAL) FVM CMMACS 19 / 65
Diffusion equation: Initial condition t Praveen. C (CTFD, NAL) FVM CMMACS 20 / 65
Diffusion equation t ∆ t t+ Praveen. C (CTFD, NAL) FVM CMMACS 21 / 65
Diffusion equation Scalar diffusion equation ∂ t = µ∂ 2 u ∂ u ∂ x 2 Solution u ( x , t ) ∼ e − µ k 2 t f ( x ; k ) Solution is smooth and decays with time Elliptic equation Praveen. C (CTFD, NAL) FVM CMMACS 22 / 65
Outline Divergence theorem 1 Conservation laws 2 3 Convection-diffusion equation FVM in 1-D 4 Stability of numerical scheme 5 Non-linear conservation law 6 Grids and finite volumes 7 FVM in 2-D 8 Summary 9 10 Further reading Praveen. C (CTFD, NAL) FVM CMMACS 23 / 65
FVM in 1-D: Conservation law 1-D conservation law ∂ u ∂ t + ∂ ∂ x f ( u ) = 0 , a < x < b , t > 0 Initial condition u ( x , 0 ) = g ( x ) Boundary conditions at x = a and/or x = b Praveen. C (CTFD, NAL) FVM CMMACS 24 / 65
FVM in 1-D: Grid Divide computational domain into N cells a = x 1 / 2 , x 1 + 1 / 2 , x 2 + 1 / 2 , . . . , x N − 1 / 2 , x N + 1 / 2 = b hi i=N i=1 i i−1/2 i+1/2 x=b x=a Cell number i C i = [ x i − 1 / 2 , x i + 1 / 2 ] Cell size (width) h i = x i + 1 / 2 − x i − 1 / 2 Praveen. C (CTFD, NAL) FVM CMMACS 25 / 65
FVM in 1-D Conservation law applied to cell C i � x i + 1 / 2 � ∂ u ∂ t + ∂ f � d x = 0 ∂ x x i − 1 / 2 Ci i−3/2 i−1/2 i+1/2 i+3/2 h i Cell-average value � x i + 1 / 2 u i ( t ) = 1 u ( x , t ) d x h i x i − 1 / 2 Integral form d u i d t + f ( x i + 1 / 2 , t ) − f ( x i − 1 / 2 , t ) = 0 h i Praveen. C (CTFD, NAL) FVM CMMACS 26 / 65
FVM in 1-D i=N i=1 i−1 i i+1 i−1/2 i+1/2 x=b x=a Cell-average value is dicontinuous at the interface What is the flux ? Numerical flux function f ( x i + 1 / 2 , t ) ≈ F i + 1 / 2 = F ( u i , u i + 1 ) Praveen. C (CTFD, NAL) FVM CMMACS 27 / 65
FVM in 1-D Finite volume update equation (ODE) d u i h i d t + F i + 1 / 2 − F i − 1 / 2 = 0 , i = 1 , . . . , N Telescopic collapse of fluxes N � d u i � � h i d t + F i + 1 / 2 − F i − 1 / 2 = 0 i = 1 N d � h i u i + F N + 1 / 2 − F 1 / 2 = 0 d t i = 1 Rate of change of total u = -(Net flux across the domain) hi i=N i=1 i i−1/2 i+1/2 x=b x=a Praveen. C (CTFD, NAL) FVM CMMACS 28 / 65
Time integration At time t = 0 set the initial condition � x i + 1 / 2 i := u i ( 0 ) = 1 u o g ( x ) d x h i x i − 1 / 2 Choose a time step ∆ t (stability and accuracy) or M Break time ( 0 , T ) into M intervals ∆ t = T t n = n ∆ t , M , n = 0 , 1 , 2 , . . . , M For n = 0 , 1 , 2 , . . . , M , compute u n i = u i ( t n ) ≈ u ( x i , t n ) i − ∆ t u n + 1 = u n ( F n i + 1 / 2 − F n i − 1 / 2 ) i h i Praveen. C (CTFD, NAL) FVM CMMACS 29 / 65
Numerical Flux Function Take average of the left and right cells U i+1 U i i+1/2 F i + 1 / 2 = 1 2 [ f ( u i ) + f ( u i + 1 )] Central difference scheme d u i d t + f i + 1 − f i − 1 = 0 h i Suitable for elliptic equations (diffusion phenomena) Unstable for hyperbolic equations (convection phenomena) Praveen. C (CTFD, NAL) FVM CMMACS 30 / 65
Convection equation: Centered flux Convection equation, a = constant ∂ u ∂ t + a ∂ u ∂ x = 0 , f ( u ) = au Centered flux, F i + 1 / 2 = ( au i + au i + 1 ) / 2 d u i d t + au i + 1 − u i − 1 = 0 h i U i+1 U i i+1/2 Praveen. C (CTFD, NAL) FVM CMMACS 31 / 65
Convection equation: Upwind flux Upwind flux U i+1 U i i+1/2 � au i , if a > 0 F i + 1 / 2 = au i + 1 , if a < 0 or F i + 1 / 2 = a + | a | u i + a − | a | u i + 1 2 2 Praveen. C (CTFD, NAL) FVM CMMACS 32 / 65
Convection equation: Upwind flux Upwind scheme d u i d t + au i − u i − 1 = 0 , a > 0 if h i d u i d t + au i + 1 − u i = 0 , a < 0 if h i or d t + a + | a | u i − u i − 1 + a − | a | u i + 1 − u i d u i = 0 2 h i 2 h i Praveen. C (CTFD, NAL) FVM CMMACS 33 / 65
Recommend
More recommend