CFD Group Conservation Equations Prof. Carlo Cravero DIME – Università di Genova Governing equations • The governing equations include the following conservation laws of physics: – Conservation of mass. – Newton’s second law: the change of momentum equals the sum of forces on a fluid particle. – First law of thermodynamics (conservation of energy): rate of change of energy equals the sum of rate of heat addition to and work done on fluid particle. • The fluid is treated as a continuum. For length scales of, say, 1m and larger, the molecular structure and motions may be ignored. 2 Lagrangian vs. Eulerian description A fluid flow field can be thought of as being comprised of a large number of finite sized fluid particles which have mass, momentum, internal energy, and other properties. Mathematical laws can then be written for each fluid particle. This is the Lagrangian description of fluid motion. Another view of fluid motion is the Eulerian description. In the Eulerian description of fluid motion, we consider how flow properties change at a fluid element that is fixed in space and time (x,y,z,t), rather than following individual fluid particles. Governing equations can be derived using each method and converted to the other form. 3 Fluid element and properties • The behavior of the fluid is described in terms macroscopic properties: – – – – – Fluid element for ofconservation laws Velocity u. Pressure p. Density r. Temperature T. Energy E. dz (x,y,z) dy dx • Typically ignore (x,y,z,t) in the notation. y z x • Properties are averages of a sufficiently large number of molecules to keep continuum properties. • A fluid element can be thought of as the smallest volume for which the continuum assumption is valid. Faces are labeled North, East, West, South, Top and Bottom 4 Mass balance – CONTINUITY EQUATION • Rate of increase of mass in fluid element equals the net rate of flow of mass into element. ( rdxdydz) r dxdydz • Rate of increase is: t t • The inflows (positive) and outflows (negative) are shown here: ( r w) 1 . d z d xd y rw z 2 ( r v) 1 r v . d y d xd z y 2 ( ru) 1 r u . d x d yd z x 2 ( ru ) 1 . dx dydz ru x 2 y ( rv) 1 . dy dxdz rv y 2 z x rw ( rw) . 1 dz dxdy z 2 5 Continuity equation • Summing all terms in the previous slide and dividing by the volume dxdydz results in: r ( ru) ( rv) ( rw) 0 t x y z • In vector notation: Change in density r div ( r u) 0 t Net flow of mass across boundaries Convective term • For incompressible fluids r / t = 0, and the equation becomes: div u = 0. ui u v w 0 • Alternative ways to write this: x y z and x 0 i 6 Different forms of the continuity equation Finite control volume fixed in space Finite control volume fixed mass moving with flow r dV r U dS 0 t V S Integral form D r dV 0 Dt V Integral form Conservation form Non conservation form U Infinitesimally small element fixed in space Infinitesimally small fluid element of fixed mass (“fluid particle”) moving with the flow r ( rU) 0 t Differential form Dr r U 0 Dt Differential form Conservation form Non conservation form 7 Rate of change for a fluid particle (Lagrangian) • Terminology: fluid element is a volume stationary in space, and a fluid particle is a volume of fluid moving with the flow. • A moving fluid particle experiences two rates of changes: – Change due to changes in the fluid as a function of time. – Change due to the fact that it moves to a different location in the fluid with different conditions. • The sum of these two rates of changes for a property per unit mass is called the total or substantive derivative D /Dt: D dx dy dz Dt t x dt y dt z dt • With dx/dt=u, dy/dt=v, dz/dt=w, this results in: D u.grad Dt t 8 Rate of change for a stationary fluid element (Eulerian) • In most cases we are interested in the changes of a flow property for a fluid element, or fluid volume, that is stationary in space. • However, some equations are easier derived for fluid particles. For a moving fluid particle, the total derivative per unit volume of this property is given by: (for moving fluid particle) r D r u.grad Dt t (for given location in space) • For a fluid element, for an arbitrary conserved property : r div ( r u) 0 t Continuity equation ( r ) div ( r u) 0 t Arbitrary property 9 Fluid particle and fluid element • We can derive the relationship between the equations for a fluid particle (Lagrangian) and a fluid element (Eulerian) as follows: ( r ) D r div( r u) r u.grad div( ru) r t Dt t t zero because of continuity ( r ) D div( r u) r t Dt Rate of increase of of fluid element Net rate of flow of out of fluid element = Rate of increase of for a fluid particle 10 To remember so far: • We need to derive conservation equations that we can solve to calculate fluid velocities and other properties. • These equations can be derived either for a fluid particle that is moving with the flow (Lagrangian) or for a fluid element that is stationary in space (Eulerian). • For CFD purposes we need them in Eulerian form, but they are somewhat easier to derive in Lagrangian form. • Luckily, when we derive equations for a property in one form, we can convert them to the other form using the relationship shown on the bottom in the previous slide. 11 Relevant entries for Φ x-momentum u Du r Dt ( ru ) div ( ruu) t y-momentum v r Dv Dt ( rv) div ( rvu) t z-momentum w r Dw Dt ( rw) div ( rwu) t Energy E DE r Dt ( rE ) div ( rEu) t 12 Momentum equation • We will first derive conservation equations for momentum and energy for fluid particles. Next we will use the above relationships to transform those to an Eulerian frame (for fluid elements). • We start with deriving the momentum equations. • Newton’s second law: rate of change of momentum equals sum of forces. • Rate of increase of x-, y-, and z-momentum: Du Dv Dw r r r Dt Dt Dt • Forces on fluid particles are: – Surface forces such as pressure and viscous forces. – Body forces, which act on a volume, such as gravity, centrifugal, Coriolis, and electromagnetic forces. 13 Viscous stresses • Stresses are forces per area. Unit is N/m2 or Pa. • Viscous stresses denoted by t. • Suffix notation tij is used to indicate direction. • Nine stress components. – txx, tyy, tzz are normal stresses. E.g. tzz is the stress in the z-direction on a z-plane. – Other stresses are shear stresses. E.g. tzy is the stress in the y-direction on a z-plane. • Forces aligned with the direction of a coordinate axis are positive. Opposite direction is negative. 14 Forces in the x-direction (t yx t yx 1 . dy )dxdz y 2 t zx 1 (t zx . dz )dydz t yx 1 z 2 (t yx . dy )dxdz y 2 p 1 ( p . dx)dydz x 2 p 1 ( p . dx)dydz x 2 t xx 1 (t xx . dx)dydz x 2 z y x (t xx t xx 1 . dx)dydz x 2 t zx 1 (t zx . dz )dxdy z 2 Net force in the x-direction is the sum of all the force components in that direction. 15 Momentum equation • Set the rate of change of x-momentum for a fluid particle Du/Dt equal to: – the sum of the forces due to surface stresses shown in the previous slide, plus – the body forces. These are usually lumped together into a source term SM: Du ( p t xx ) t yx t zx r S Mx Dt x y z – p is a compressive stress and txx is a tensile stress. • Similarly for y- and z-momentum: r Dv t xy ( p t yy ) t zy S My Dt x y z Dw t xz t yz ( p t zz ) r S Mz Dt x y z 16 Energy equation • First law of thermodynamics: rate of change of energy of a fluid particle is equal to the rate of heat addition plus the rate of work done. • Rate of increase of energy is rDE/Dt. • Energy E = i + ½ (u2+v2+w2). • Here, i is the internal (thermal energy). • ½ (u2+v2+w2) is the kinetic energy. • Potential energy (gravitation) is usually treated separately and included as a source term. • We will derive the energy equation by setting the total derivative equal to the change in energy as a result of work done by viscous stresses and the net heat conduction. • Next we will subtract the kinetic energy equation to arrive at a conservation equation for the internal energy. 17 Work done by surface stresses in x-direction (ut zx ) 1 (ut zx . dz )dydz (ut yx ) 1 (ut yx ) 1 z 2 (ut yx . dy )dxdz (ut yx . dy )dxdz y 2 y 2 (up) 1 (up . dx)dydz x 2 (up (ut xx ) 1 (ut xx . dx)dydz x 2 (ut xx (up) 1 . dx)dydz x 2 (ut xx ) 1 . dx)dydz x 2 z y x (ut zx (ut zx ) 1 . dz )dxdy z 2 Work done is force times velocity. 18 Work done by surface stresses • The total rate of work done by surface stresses is calculated as follows: – For work done by x-components of stresses add all terms in the previous slide. – Do the same for the y- and z-components. • Add all and divide by dxdydz to get the work done per unit volume by the surface stresses: (ut xx ) (ut yx ) (ut zx ) (vt xy ) div ( pu) x y z x (vt yy ) (vt zy ) ( wt xz ) ( wt yz ) (ut zz ) y z x y z 19 Energy flux due to heat conduction q y 1 (q y . dy )dxdz y 2 q x 1 (q x . dx)dydz x 2 (q z q z 1 . dz )dxdy z 2 q x 1 (q x . dx)dydz x 2 z y x q z 1 (q z . dz )dxdy z 2 q y 1 (q y . dy )dxdz y 2 The heat flux vector q has three components, qx, qy, and qz. 20 Energy flux due to heat conduction • Summing all terms and dividing by dxdydz gives the net rate of heat transfer to the fluid particle per unit volume: q x q y q z div q x y z • Fourier’s law of heat conduction relates the heat flux to the local temperature gradient: qx k T x qy k T y qz k T z • In vector form: q k grad T • Thus, energy flux due to conduction: div q div(k grad T ) • This is the final form used in the energy equation. 21 Energy equation • Setting the total derivative for the energy in a fluid particle equal to the previously derived work and energy flux terms, results in the following energy equation: (ut xx ) (ut yx ) (ut zx ) (vt xy ) DE r div ( pu) Dt y z x x (vt yy ) y (vt zy ) z ( wt xz ) ( wt yz ) (ut zz ) x y z div ( k grad T ) S E • Note that we also added a source term SE that includes sources (potential energy, sources due to heat production from chemical reactions, etc.). 22 Kinetic energy equation • Separately, we can derive a conservation equation for the kinetic energy of the fluid. • In order to do this, we multiply the u-momentum equation by u, the v-momentum equation by v, and the w-momentum equation by w. We then add the results together. • This results in the following equation for the kinetic energy: D[ 12 (u 2 v 2 w 2 )] t xx t yx t zx r u.grad p u Dt y z x t xy t yy t zy t xz t yz t zz v w u. S M y z y z x x 23 Internal energy equation • Subtract the kinetic energy equation from the energy equation. • Define a new source term for the internal energy as Si = SE - u.SM. This results in: Di u u v u r p div u t xx t yx t zx t xy Dt y z x x v v w w u t yy t zy t xz t yz t zz y z x y z div (k grad T ) S i 24 Enthalpy equation • An often used alternative form of the energy equation is the total enthalpy equation. – Specific enthalpy h = i + p/r. – Total enthalpy h0 = h + ½ (u2+v2+w2) = E + p/r. ( r h0 ) div( r h0u) div(k grad T ) t (ut yx ) (vt xy ) (ut xx ) (ut zx ) y z x x (vt yy ) y (vt zy ) z ( wt yz ) ( wt xz ) (ut zz ) x y z Sh 25 Equations of state • Fluid motion is described by five partial differential equations for mass, momentum, and energy. • Amongst the unknowns are four thermodynamic variables: r, p, i, and T. • We will assume thermodynamic equilibrium, i.e. that the time it takes for a fluid particle to adjust to new conditions is short relative to the timescale of the flow. • We add two equations of state using the two state variables r and T: p=p(r,T) and i=i(r,T). • For a perfect gas, these become: p=r RT and i=CvT. • At low speeds (e.g. Ma < 0.2), the fluids can be considered incompressible. There is no linkage between the energy equation, and the mass and momentum equation. We then only need to solve for energy if the problem involves heat transfer. 5 conservation eq. 6 primitive variables (p,r,u,v,w,T) Additional condition to close the problem : equation of state 26 Viscous stresses • A model for the viscous stresses tij is required. • We will express the viscous stresses as functions of the local deformation rate (strain rate) tensor. • There are two types of deformation: – Linear deformation rates due to velocity gradients. • Elongating stress components (stretching). • Shearing stress components. – Volumetric deformation rates due to expansion or compression. • All gases and most fluids are isotropic: viscosity is a scalar. • Some fluids have anisotropic viscous stress properties, such as certain polymers and dough. We will not discuss those here. 27 Stress Tensor – Constitutive equation Newtonian vs. non-Newtonian t (Pa) Newtonian fluids: water, air. Newtonian (high μ) Pseudoplastic fluids: paint, printing ink. Casson fluid Dilatant fluids: dense slurries, t0 wet cement. Bingham fluids: toothpaste, clay. Bingham-plastic Pseudo-plastic (shear-thinning) tc Newtonian (low μ) Casson fluids: blood, yogurt. Dilatant (shear-thickening) Visco-elastic fluids: polymers (not shown in graph because viscosity is not isotropic). Strain rate (1/s) 28 Viscous stress tensor – Newtonian Fluid • Using an isotropic (first) dynamic viscosity for the linear deformations and a second viscosity l=-2/3 for the volumetric deformations results in: t xx t xy τ t yx t yy t zx t zy t xz t yz t zz u 2 u v u w 2 div u z x y x x 3 v 2 v w u v 2 div u y 3 z y y x w 2 v w u w div u 2 z x z 3 z y Note: div u = 0 for incompressible fluids. 29 Navier-Stokes equations • Including the viscous stress terms in the momentum balance and rearranging, results in the Navier-Stokes equations: x momentum : ( ru ) p div( ruu) div( grad u ) S Mx t x y momentum : ( rv) p div( rvu) div( grad v) S My t y z momentum : ( rw) p div( rwu) div( grad w) S Mz t z 30 Viscous dissipation • Similarly, substituting the stresses in the internal energy equation and rearranging results in: Internal energy : ( ri ) div( riu) p div u div(k grad T ) F Si t • Here F is the viscous dissipation term. This term is always positive and describes the conversion of mechanical energy to heat. 2 2 u 2 v w 2 u v F 2 x y z y x u w v w z x z y 2 2 2 2 ( div u ) 3 31 Summary of equations in conservation form r div( r u) 0 t Mass : x momentum : ( ru ) p div( ruu) div( grad u ) S Mx t x y momentum : ( rv) p div( rvu) div( grad v) S My t y ( rw) p div( rwu) div( grad w) S Mz t z z momentum : Internal energy : ( ri ) div( riu) p div u div(k grad T ) F Si t Equations of state : p p( r , T ) and i i ( r , T ) e.g. for perfect gas : p r RT and i CvT 32 General transport equations • The system of equations is now closed, with seven equations for seven variables: pressure, three velocity components, enthalpy, temperature, and density. • There are significant commonalities between the various equations. Using a general variable , the conservative form of all fluid flow equations can usefully be written in the following form: r div r u div grad S t • Or, in words: Rate of increase of of fluid + element Net rate of flow of out of fluid element (convection) = Rate of increase of due to + diffusion Rate of increase of due to sources 33 Integral form • The key step of the finite volume method is to integrate the differential equation shown in the previous slide, and then to apply Gauss’ divergence theorem, which for a vector a states: div a dV n a dA CV A • This then leads to the following general conservation equation in integral form: r dV n ( r u) dA n ( grad ) dA S dV t CV A A CV Rate of increase of Net rate of decrease of due + to convection = across boundaries Net rate of increase of due + to diffusion across boundaries Net rate of creation of • This is the actual form of the conservation equations solved by finite volume based CFD programs to calculate the flow pattern and associated scalar fields (discretization techniques) 34 Compact vector form Conservative variables The compact vector form contains a set of conservation equations of the same form (see General Transport Equation) and it is used for software implementation It can be easily extended to solve additional equations ….. 35 Mathematical problem A coupled system of non-linear second order partial differential equations (PDE) PDE can be: - Hyperbolic - Parabolic - Elliptic PDE are solved by setting: - Initial conditions - Boundary Conditions 36