1 / 48

Simulation and Animation

Simulation and Animation. Fluids. Fluid simulation. Content Fluid simulation basics Terminology Navier-Stokes equations Derivation and physical interpretation Computational fluid dynamics Discretization Solution methods . Fluid simulation. Simulation of the behavior of fluid flow

gyala
Download Presentation

Simulation and Animation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Simulation and Animation Fluids

  2. Fluid simulation • Content • Fluid simulation basics • Terminology • Navier-Stokes equations • Derivation and physical interpretation • Computational fluid dynamics • Discretization • Solution methods

  3. Fluid simulation • Simulation of the behavior of fluid flow • Interaction and forces between fluid particles and solid bodies • Result of physical properties of fluids • Viscosity generates frictional forces • External forces • Gravitation and other forces • Flow models • Laminar flow • Fluid consists of individual layers sliding over each other • Turbulent flow • Particles in different layers become mixed due to low friction

  4. Fluid simulation Flow models Laminar flow: no fluid exchangebetweenlayers Turbulent flow: nodistinctlayers, fluid exchangefree

  5. Fluid simulation • Flow movementdepends on • Viscousforce • Inertialforce (Trägheitskraft) • Describedby Reynolds number, whichdepends on • Velocityofthe fluid, viscosityanddensity, characteristiclength D oftheflowregion • Reynolds number (Re) • The tendencyofflowtobe laminar (Re isverysmall) or turbulent (Re isvery large) • laminar if Re < 2300 • transient for 2300 < Re < 4000 • turbulent if Re > 4000 Re =  D V / 

  6. Fluid simulation • Approaches to describe flow fields • Eulerian • Focus is on particular points in the flow occupied by the fluid • Record state of a finite control volume around that point • Dye injection for visualizing flows • Lagrangian • Consider particles and follow their path through the flow • Record state of the particle along the path • Particle tracing for visualizing flows

  7. Fluid simulation • Basic equations of fluid dynamics • Rely on • Physical principles • Conservation of mass • F=ma • Conservation of energy • Applied to a model of the flow • Finite control volume approach • Infinitesimal particle approach • Derivation of mathematical equations • Continuity equation • Navier-Stokes equations

  8. Fluid simulation • Models of the flow • Finite control volume Control surface S V Control volume V Fixed volume, fluid movesthroughit

  9. Fluid simulation • Models of the flow • Infinitesimal fluid element Volume dV dV Element moving along the streamlines Fixed fluid element, fluid movesthroughit

  10. Flow simulation Governingequationsof fluid flow • Finite controlvolumeapproach • Applyphysicalprincipalsto fluid in controlvolumeandpassingthroughcontrolsurface • Yieldsequations in integral form • Distinguishbetweenconservation (fixedvolume) andnonconservation (movingvolume) form • Infinitesimal fluid element • Applyphysicalprincipalsto infinitesimal fluid particle • Yielsequations in partial differential form • Distinguishbetweenconservation (fixedparticle) andnonconservation (movingparticle) form

  11. Navier-Stokes equations • A moving fluid element y V=ui+vj+wk V1 t = 1 x V2 t = 2 z

  12. Fluid simulation • The time rate ofchangeofdensity • Particlemovesfrom 1 to 2 • Assumedensity(x,y,z,t) tobecontinuousand ... • Thus, Taylor seriesexpansioncanbeperformed • Dividingby (t2-t1) ignoringhigher order termsandtakingthelimit:

  13. Fluid simulation • The substantial derivative • Time rate ofchangeofdensitywhenmovingfrom 1 to 2 • Physicallyandnumerically different tothe time rate ofchangeofdensityatfixedpoint (/t) (local derivative) • With

  14. Fluid simulation • The substantial derivative • V: convective derivative • Time rate ofchange due tomovementtopositionwith different properties • D/Dtappliedtoany variable yieldschange due tolocalfluctuationsand time andspatialfluctuations • Can beappliedtoanyflowfield variable • Pressure (p), temperatur (T), velocity (V) etc.

  15. Navier-Stokes equations • The continuityequation • Physicalprincipal: conservationofmass • Finite fixedcontrolvolume: • Infinitesimal fluid particle Time rate of decrease of mass inside control volume Net massflow out ofcontrolvolumethroughsurface = Time rate of mass decrease inside element Net mass flow out of element =

  16. Navier-Stokes equations • The continuityequation • The model: infinitesimal elementfixed in space • Considermassfluxthroughelement dy dz dx

  17. Navier-Stokes equations • The continuityequation • Infinitesimal elementfixed in space • Net outflow in x-direction (equalfor y/z-direction): • Net massflow: • Time rate ofmassincrease:

  18. Navier-Stokes equations • The continuityequation Net mass flow out of element + Time rate of mass increase inside element The partial differential form ofthecontinuityequation Other modelsyieldotherformsofthecontinuityequation, whichcanbeobtainedfromeachother

  19. Navier-Stokes equations • The momentumequation (Impulsgleichung) • Physicalprincipal: Newton´ssecondlaw F=ma • Consider an infinitesimal movingelement • Sketch sourcesoftheforcesacting on it • Consider x/y/z componentsseparately • Fx = max • First considerleftsideof F=ma • F = FB + FS • Sumofbodyforcesandsurfaceforcesacting on element

  20. Navier-Stokes equations • The momentumequation • F = FB + FS (bodyforcesandsurfaceforces) • Body forces • Actat a distance (Gravitational, electric, magneticforces) • FB = fx(dxdydz) • Surfaceforcesact • Act on surfaceofelement • Can besplitintopressureandviscousforcesFS = FPress + FVis • Pressureforce:imposedby outside fluid, actinginwardand normal tosurface • Viscousforce:imposedbyfriction due toviscosity, result in shearand normal stress imposedby outside fluid

  21. Navier-Stokes equations • Sketch offorces (x-directiononly) • Convention: positive increasesof V along positive x/y/z Y 6 2 Sy (shear stress) sz‘ P (pressure force) 7 3 p‘ nx (normal stress) nx‘ sz 4 0 X sy‘ 1 5 Z

  22. Navier-Stokes equations • Surface forces Shear stress Normal stress Y Y yx xx X X Time rate of change of shear deformation Time rate of change of shear volume

  23. Navier-Stokes equations • Surfaceforces • On face 0145: • On face 2367: • Equivalenton faces 0246 and 1357 forzx • On face 0123: • On face 4567: 6 2 Sy (shear stress) sz‘ P (pressure force) 7 3 p‘ nx (normal stress) nx‘ sz 4 0 X sy‘ 1 5

  24. Navier-Stokes equations • Total force on fluid element =

  25. Navier-Stokes equations • Consider right side of F=ma • Mass of fluid element • Acceleration is time rate of change of velocity (Du/Dt) • Thus (equivalent for v/w): The Navier-Stokes equations

  26. Navier-Stokes equations • Whatyoutypicallysee in theliteratureis • istheonly „strange“ termhere • : molecularviscosity • In Newtonianfluids, shear stress isproportionaltovelocitygradient • [shear stress] =  [strain rate] • DescribedbyNavier-Stokes equations • Non-Newtonianfluidsobey different property, e.g. blood, motoroil • Viscosityis not a constant • Depends on temperatureandpressure

  27. Navier-Stokes equations • From Stokes weknow (let‘s just believeithere)  : molecularviscosity : secondorbulkviscosity

  28. Navier-Stokes equations • Incompressiblefluids •  = constant •  = constant •  canbetaken outside of partial derivatives in NSE Divergencefree (all -terms on previouspagevanish)

  29. Navier-Stokes equations • With • Weobtain Sketch of derivation: • Write div(V)=0 and resolve for u/x • Partially differentiate both sides with respect to x • Add 2u/x2 on both sides

  30. Navier-Stokes equations • Euler equations • Inviscidflow – noviscosity • Onlycontinuityandmomentumequation

  31. CFD – Computational Fluid Dynamics • Solution methodsforgoverningequations • Governingequationshavebeenderivedindependentofflowsituation, e.g. flowaround a carorinside a tube • Boundary (andinitial) conditionsdeterminespecificflowcase • Determinegeometryofboundariesandbehaviorofflowatboundaries • Different kindsofboundaryconditionsexist • Hold atany time duringsimulation • Lead to different solutionsofthegoverningequations • Exactsolutionexistsforspecificconditions • Initial conditionsspecifystatetostartwith

  32. CFD – Computational Fluid Dynamics • Solution methods of partial differential equations • Analytical solutions • Lead to closed-form epressions of dependent variables • Continuously describe their variation • Numerical solutions • Based on discretization of the domain • Replace PDEs and closed form expression by approximate algebraic expressions • Partial derivatives become difference quotients • Involves only values at finite number of discrete points in the domain • Solve for values at given grid points

  33. CFD – Computational Fluid Dynamics • Discretization • Layout ofgridpoints on a grid • Locationofdiscretepointsacrossthedomain • Arbitrarygridscanbeemployed • Structured orunstructuredgrids • Implicitor explicit representationoftopology (adjacencyinformation) • Uniform grids: uniform spacingofgridpoints in x and y y Pij+1 Pi-1j+1 Pi+1j+1 y Pij Pi-1j Pi+1j y = x Pij-1 Pi-1j-1 Pi+1j-1 x x

  34. CFD – Computational Fluid Dynamics • Finite differences • Approximate partial derivatives by finite differencesbetweenpoints • Derivedbyconsideringthe Taylor expansion

  35. CFD – Computational Fluid Dynamics Derivedbyconsideringthe Taylor expansion

  36. CFD – Computational Fluid Dynamics • Finite differences for higher order and mixed partial derivatives

  37. CFD – Computational Fluid Dynamics • Differenceequations - example • The 2D waveequation Partial Differential Equation Discretization on a 2D CartesiangridsyieldsDifferenceEquation

  38. CFD – Computational Fluid Dynamics • Explicit approach • Marching solution with marching variable t • Values at time t+1 are computed from known values at time t and t-1 • Step through all interior points of domain and update ut+1

  39. CFD – Computational Fluid Dynamics • Explicit vs. Implicitapproach • Explicit approach • Differenceequationcontainsoneunknown • Can besolvedexplicitelyforit • Implicitapproach • Differenceequationcontainsmorethanoneunknown • Solution bysimultaneouslysolvingfor all unknown • System ofalgebraicequationstobesolved e.g. Crank-Nicolson

  40. CFD – Computational Fluid Dynamics • Implicit Crank-Nicholson scheme

  41. ComputationalFluid Dynamics • Implicitapproach – example • Poissonequation: • Discretization:

  42. Advection Describes in what direction a “neighboring” regionoffluid pushes fluidatu Pressure Describes in which direction fluid atu is pushedtoreach a lowerpressurearea Diffusion Describeshowquicklyvariations in velocityaredamped-out; depends on fluid viscosity Zero Divergence ExternalForces The Equations Solution oftheNavier-Stokes equations

  43. NSE Discretization

  44. Navier-Stokes Equations (cont.) Rewrite the Navier-Stokes Equations where now F and G can be computed

  45. Navier-Stokes Equations (cont.) Problem: Pressure is still unknown! From derive: and end up with this Poisson Equation after discretization:

  46. ComputationalFluid Dynamics The algorithm • Step 1:computeFtandGt • Useveocitiesutandvtanddifferenceequationsfor partial derivatives • Step 2:solveequationsforpressure pt+1 • Discretizesecond order partial derivatives • UseJacobi, Gauss-Seidel, orConjugate Gradient method • Step 3:computenewvelocities ut+1, vt+1

  47. CFD – Computational Fluid Dynamics • Boundary conditions (2D) • No-slip condition • Fluid is fixed to boundary; velocities should vanish at boundaries or have velocities of moving boundaries • Free-slip condition • Fluid is free to move parallel to the boundary; velocity component normal to boundary vanishes • Outflow conditions • Velocity into direction of boundary normal does not change • Inflow conditions • Velocities are given explicitely

  48. Demo

More Related