Finite volume method for CFD Indo-German Winter Academy-2007 Ankit Khandelwal B-tech III year, Civil Engineering IIT Roorkee Course #2 (Numerical methods and simulation of engineering Problems) Mentor: Dr. Suman Chakraborty, IIT Kharagpur Dr. Vivek V. Buwa, IIT Delhi
Overview Conservation Laws Discretisation Concept Concept of Finite Volume Method FVM for 1D Steady state diffusion FVM for Convection and Diffusion Calculation of Flow Field 1. Vorticity Approach 2. Preliminary Variable approach SIMPLE Algorithm SIMPLER Algorithm 1D Unsteady State Heat Conduction
Conservation Laws Conservation of Mass Conservation of Momentum Conservation of Energy
Conservation of Chemical Species ( ρm t l ) + div ( ρum l + J l ) = R t δz δy Rate of change of mass Convection Flux Diffusion flux δx *m l : mass fraction of chemical species u : velocity field R t : rate of generation of the chemical species per unit volume. By the use of Flick's Law J 1 = Γ l (grad m l ). Γ l : diffusion coefficient.
Conservation of Momentum ( ρ t u) + div ( ρ uu ) = div ( μ gradu ) p x + + Bx Vx Transient term Advective term Diffusive term μ: : Coefficient of viscosity p: pressure B x : x-direction x body force per unit volume. Vx: Viscous terms in addition to those expressed by div(μ grad u).
Conservation of Energy For a steady low-velocity flow with negligible viscous dissipation is Energy equation is div (ρuh) = div( kgradt) + S h h: specific enthalpy k: thermal conductivity T : Temperature S h : Volumetric Rate of heat generation For ideal gases and for liquids and solids, h= ct, for a constant c. Equation reduces to: div(ρut ) k = div( gradt ) c + S c h
General Differential Equation ( ρφ ) t + div( ρuφ ) = div( Γgrad φ ) + S Unsteady term Convection term Diffusion term Source term Γ : diffusion coefficient Φ : Dependent variable, stand for different quantities, like mass fraction of chemical species, enthalpy or temperature, velocity component
Nature of Coordinates Φ = Φ( ( x,y,z,t) With respect to x: 1D, 2D, 3D With respect to t: unsteady and steady Computational Saving is achieved by decreasing independent variable, eg: flow around an airplane, axisymmetric flow in circular pipe etc.. One way (parabolic) and two way (elliptic) coordinates.
Inference from Conservation laws Conservation equations are governed by partial differential equation. These equations can be represented as a general equation for the variable φ. Analytical Solutions exist for few cases and many a times complex. Numerical methods have to applied. Numerical method should employ the values of Φ as the primary unknown.
Discretization Concept Transferring continuous models and equations into discreet counterparts.
Concept of Finite Volume Method Subdivide the problem domain into non overlapping control volumes Integrate the governing equation over each of these control volumes. Representative value of variable = value of the variable at the geometric centre of CV Piecewise profiles expressing the variation of φ between the grid points are used to evaluate the integrals. Discretized equation obtained in this manner, represents the conservation principle for the finite control volume.
Finite Volume Grid δ x w δ x e N Δ y W P E δ y n δ y s S Δ x
FVM for 1D steady State diffusion Governing equation of diffusion is d dx d φ ( Γ ) + S = dx 0 Γ : Diffusion coefficient S: Source term Boundary values of A and B are prescribed
Contd. Step 1: Grid generation w Δx e W Step 2: Discretization P E Δv d ( Γ dx dφ ) dv dx + Δv SdV dφ = ( ΓA ) dx e dφ ( ΓA ) dx w + S ΔV = 0 A: cross-sectional area of control volume ΔV: Volume of Control Volume S : Average value of Source over control volume.
Contd. Interpolating linearly Γ w = ( ΓW + Γ P ) ( Γ P + Γ E, Γ e = 2 2 Diffusive Flux terms are as follows ( ΓA ( ΓA dφ ( φ E φ P ) ) e = Γe Ae dx δx PE dφ ( φw φ P ) ) w = Γw Aw dx δx WP ) Using Central differencing scheme
Contd. Finally the equation is: a p Φ p = a w Φ w + a e Φ E + S u a W a E a P ΓW A δ x WP W Γ E A δ x Now, Discretized equations must be setup at each of the nodal points PE E a W + a E S P
FVM for Convection and Diffusion problem Governing equation for the process is: d dx ( ρuφ ) The Continuity equation : = d dx ( Γ dφ ) dx d dx ( ρ u ) = 0 There are various approaches to find the numerical solution of a convection diffusion problem.
Discretization Scheme Central Differencing Scheme Upwind differencing scheme Hybrid differencing scheme Power Law Scheme Quick Scheme
Calculation of Flow Field Flow field needs to be calculated from appropriate governing equations Velocity component is governed by momentum equations Difficulties: 1. Pressure gradient forms a part of the source term for the momentum equation. 2. There is no obvious equation for obtaining Pressure. Once the correct pressure field is substituted in momentum equation, resultant Velocity field satisfies Continuity equation
Vorticity Based Methods Pressure gradient term is eliminated from the momentum equation by cross differentiating the 2 components of the momentum equation (in a 2-D flow) and subtracting them. This gives rise to the following equation involving Vorticity vector ζ. The equation for the stream function ψ(x,y) is given as ] [ 2 2 2 2 y x y v x u t + = + + ζ ζ ρ μ ζ ζ ζ ζ ψ ψ = + 2 2 2 2 y x
Assessment of Vorticity based Merits: method 1. Pressure makes no appearance 2. Need to solve only two equations to obtain ζ and and ψ. 3. Poisson s equation can be used to derive pressure. Demerits: 1. Value of vorticity at a wall is difficult to specify and causes trouble in getting converged solution 2. Pressure is required for calculation of density and other fluid properties. 3. Extraction of pressure from vorticity offsets computational saving 4. Cannot be extended to 3-D situations for which a streamfunction does not exist.
Primitive Variables Method To overcome the shortcomings of the vorticity method primitive variable method is used Dependent variables are the velocity components and pressure. Need to solve the velocity equations and the continuity equation simultaneously. Main task is to convert the indirect information in the continuity equation into direct algorithm for the calculation of pressure.
Representation of Pressure Gradient term W w P e E Integration of pressure gradient over control volume gives P w - P e Assuming linear profile: P w -P e = (P W + P P )/2 (P P + P E )/2 = (P W P E )/2 Momentum equation contains the pressure difference between alternate grid points.
Contd. 100 200 100 200 100 200 100 It is a zig-zag zag pressure field Formula predicts it as uniform pressure field. Similar is the case with 2D and 3D fields.
Representation of the Continuity Equation Continuity equation for 1D can be written as u x = 0 Integrating over control volume u E -u W = 0 Again the continuity equation wants the equality of velocities at alternate grid points Where is the Flaw? The flaw is in the fact that we are calculating all the variables for the same grid points.
REMEDY: The Staggered Grid Arrange the velocity components on a different grid. This grid is called the staggered grid. Velocity components are calculated at CV faces which form the staggered grid Pressure is evaluated at the main grid points.
Staggered Grid Dotted line represents the Staggered Grid. Velocity Components lie on the faces of CV. u point v point P point
Advantages of Staggered grid Discretized Continuity equation will contain difference of adjacent velocity components. Pressure difference between two adjacent grid points becomes the driving force for the velocity component located between them.
Momentum Equation Discretised x momentum equation for the staggered CV shown in the fig is: a e u e = a nb u nb + b + (P P -P E )A e subscript nb represents neighboring term. Discretised y momentum equation for the staggered CV shown in the fig is a n u n = a nb u nb + b + (P P -P N )A n Staggered grid for Velocity
Contd. Momentum equation can be solved only if pressure field is given or somehow estimated. Unless the correct pressure field is known the resulting velocity field will not satisfy the continuity equation. Any inaccurate velocity field resulting from a guessed value p*,will be denoted by u*,v*,w*. They are related by the following momentum equations : a e u e * = a nb u nb * + b + (P P *- P E *)A e a n u n * = a nb u nb * + b + (P P *- P N *)A n a t w t * = a nb w nb * + b + (P P *- P t *)A t Aim: find a way of improving these guessed values p* such that the resulting value of velocities satisfy the continuity equation. Hence we employ a pressure correction and the corresponding velocity correction.
Velocity Corrections Suppose we employ a correction p` to the guessed value p* of the pressure and the corresponding corrections in velocity be u',v',w'.then using the momentum equation the following relation can be derived. If effect of neighbors is neglected u e = u e * + d e ( P P` - P E`) v n = v n * + d n ( P P` - P N`) w n = w n * + d t ( P P` - P t`) where d e = A e /a e a e u e` = a nb u nb` + (P P`- P E`)A e
Pressure-Correction Equation We get the correction for pressure from the continuity equation. ρ ( ρu) ( ρv) ( ρw) + + + = 0 t x y z Substitution of corrected velocities in the discretised form of pressure equation gives the equation of the following form a p p P`= a E p`e + a W p`w p` + a S p`s + a T p`t + a B p B` ` + b where a $ = ρ $ d $ A #, A # = Area perpendicular to line p # a P = a E + a W + a N + a S + a T + a B b = f( u*, v*, w*)
Keep the corrected pressure p as p* SIMPLE ALGORITHM Start Guess pressure field Solve Discretised momentum equation to obtain u*, v*, w* Solve the p` equation Calculate p by adding p` to previous value of p* Calculate u,v,w from the velocity correction relation Solve all other discretized transport equations No Convergence? YES STOP
Discussion of Pressure-correction Equation Σa nb u`nb is neglected in the velocity correction equation, which enables to cast the pressure equation in a general conservative form. The algorithm is called semi implicit because, the term Σa nb u`nb which represents the implicit influence of the pressure correction on velocities is dropped. On convergence all the corrections tend to zero and there is no error induced on dropping Σa nb u`nb For high pressure flows the pressure correction formula should accommodate density correction term. Pressure obtained is a relative variable as an outcome of this algorithm and not a absolute quantity.
Drawbacks of SIMPLE Approximation of the pressure correction by neglecting the term Σa nb u nb in the SIMPLE algorithm leads to a rather exaggerated pressure correction. Due to the omission of the neighboring velocity corrections, pressure correction has to take the entire burden of correcting the velocities. This does a pretty good job of correcting velocity it does a poor job of correcting pressure. Hence we have to do many iterations before convergence could result.
SIMPLER: Revised SIMPLE Separate pressure equation is formulated to calculate the exact pressure field Velocity field is still calculated using pressure correction formula The Pressure equation: The momentum equation can be written as u e = Σa nb u a nb e + b + d e( Pp PE ) where d e = A e /a e
Contd. Define û e ( pseudo velocity ) = ( a nb u nb + b )/a e Hence the velocity is u e = û e + d e ( p P p E ) Now if we substitute this velocity field in the discretised continuity equation we get the following pressure equation. a p p P = a E p E + a W p W + a N p N + a S p S + a T p T + a B p B + b where all a s are same as before.
SIMPLER Algorithm START Guess Velocity Field Calculate coefficients of discretised momentum equation Calculate û,v and w by substituting u nb Calculate coefficients of pressure equation and solve it to get pressure field P Use P as P* and solve for u*,v*,w* Solve pressure correction equation Correct velocity field But not pressure and solve other dicretised equations No Convergence Yes STOP
SIMPLER v/s SIMPLE Although SIMPLER has been found to give faster convergence than SIMPLE, it should be recognized that one iteration of SIMPLER involves much more computational work. It involves solving the pressure equation. Calculation of û, v and w which is not there in SIMPLE. However since SIMPLER requires fewer iterations for convergence, the additional effort required is justified.
1D Unsteady State Heat Conduction Governing Equation is T T ρc = ( k ) + t x x S W w P e E W W δx we
Contd. Integrating over control volume and over a time interval from t to t +Δt+ t + Δt t + Δt t CV T T ρc dvdt = ( k ) dvdt t x x This can be written as t CV + t +Δt t CV sdvdt e w t+ Δt t+ Δt T [ ρc t t dt] dv = t T [( ka x ) e T ( ka x ) w ] dt + t+δt t _ S ΔVdt
Contd. Temperature at node is assumed to prevail over whole control volume CV t+δt T o [ ρc dt] dv = ρc( Tp Tp ) ΔV t t ρc( T P T o P ) ΔV = t+δt t [( k e TE T A δx PE P ) ( k w TP T A δx WP W )] dt + t+δt t SΔVdt (applying central differencing scheme)
Contd. Integration wrt time can be carried out in the following way t + Δt Tdt θ = 0, Explicit Scheme θ = 1, Implicit Scheme t = [ θt (1 θ ) T ] Δt θ = 0.5, Crank-Nicolson scheme P o P
Contd. The Final Discretized equation is a P T P + [ a o P = aw[ θt W (1 θ) a W + (1 θ) T o W (1 θ) a E ] + ] T a o P E [ θt + b E + (1 θ) T o E ] a P = θ(a W +a E )+a o P a W = K w /δx WP, a E = K e /δx PE, b = SΔx
Conclusion The basic conservation equations can be written in the form of a differential equation for a general variable φ. The concept of discretization can be used as a tool to solving these differential equations over a domain of interest. Finite Volume Method can be used to find the discreet solution of flow fields as well as convection diffusion problems. We discussed the various schemes under the FVM to find out the solutions of a given flow field. Finally we conclude that Finite Volume Method is a useful tool to find the solution of a given flow field.
Thank You