530 likes | 950 Views
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
E N D
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 • 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
Fluid simulation Flow models Laminar flow: no fluid exchangebetweenlayers Turbulent flow: nodistinctlayers, fluid exchangefree
Fluid simulation • Flow movementdepends on • Viscousforce • Inertialforce (Trägheitskraft) • Describedby Reynolds number, whichdepends on • Velocityofthe fluid, viscosityanddensity, 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 /
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
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
Fluid simulation • Models of the flow • Finite control volume Control surface S V Control volume V Fixed volume, fluid movesthroughit
Fluid simulation • Models of the flow • Infinitesimal fluid element Volume dV dV Element moving along the streamlines Fixed fluid element, fluid movesthroughit
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
Navier-Stokes equations • A moving fluid element y V=ui+vj+wk V1 t = 1 x V2 t = 2 z
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:
Fluid simulation • The substantial derivative • Time rate ofchangeofdensitywhenmovingfrom 1 to 2 • Physicallyandnumerically different tothe time rate ofchangeofdensityatfixedpoint (/t) (local derivative) • With
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.
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 =
Navier-Stokes equations • The continuityequation • The model: infinitesimal elementfixed in space • Considermassfluxthroughelement dy dz dx
Navier-Stokes equations • The continuityequation • Infinitesimal elementfixed in space • Net outflow in x-direction (equalfor y/z-direction): • Net massflow: • Time rate ofmassincrease:
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
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
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
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
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
Navier-Stokes equations • Surfaceforces • On face 0145: • On face 2367: • Equivalenton faces 0246 and 1357 forzx • 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
Navier-Stokes equations • Total force on fluid element =
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
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
Navier-Stokes equations • From Stokes weknow (let‘s just believeithere) : molecularviscosity : secondorbulkviscosity
Navier-Stokes equations • Incompressiblefluids • = constant • = constant • canbetaken outside of partial derivatives in NSE Divergencefree (all -terms on previouspagevanish)
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
Navier-Stokes equations • Euler equations • Inviscidflow – noviscosity • Onlycontinuityandmomentumequation
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
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
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
CFD – Computational Fluid Dynamics • Finite differences • Approximate partial derivatives by finite differencesbetweenpoints • Derivedbyconsideringthe Taylor expansion
CFD – Computational Fluid Dynamics Derivedbyconsideringthe Taylor expansion
CFD – Computational Fluid Dynamics • Finite differences for higher order and mixed partial derivatives
CFD – Computational Fluid Dynamics • Differenceequations - example • The 2D waveequation Partial Differential Equation Discretization on a 2D CartesiangridsyieldsDifferenceEquation
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
CFD – Computational Fluid Dynamics • Explicit vs. Implicitapproach • Explicit approach • Differenceequationcontainsoneunknown • Can besolvedexplicitelyforit • Implicitapproach • Differenceequationcontainsmorethanoneunknown • Solution bysimultaneouslysolvingfor all unknown • System ofalgebraicequationstobesolved e.g. Crank-Nicolson
CFD – Computational Fluid Dynamics • Implicit Crank-Nicholson scheme
ComputationalFluid Dynamics • Implicitapproach – example • Poissonequation: • Discretization:
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
Navier-Stokes Equations (cont.) Rewrite the Navier-Stokes Equations where now F and G can be computed
Navier-Stokes Equations (cont.) Problem: Pressure is still unknown! From derive: and end up with this Poisson Equation after discretization:
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
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