Fluid Dynamics David Marshburn Comp 259 April 17, 2002 Fluid properties • Imagine a volume of fluid… • position, velocity, acceleration • viscosity μ • density ρ.
Download ReportTranscript Fluid Dynamics David Marshburn Comp 259 April 17, 2002 Fluid properties • Imagine a volume of fluid… • position, velocity, acceleration • viscosity μ • density ρ.
Fluid Dynamics David Marshburn Comp 259 April 17, 2002 1 Fluid properties • Imagine a volume of fluid… • position, velocity, acceleration • viscosity μ • density ρ 2 Fluid velocity • Velocity is the physical property simulated for fluids… • Why? We’re usually interested in what the fluid’s carrying. Advection. • Velocity is denoted by u in fluid dynamics literature (even in graphics). 3 Taxonomy of Fluids • Compressible vs. incompressible – constancy of density • Rotational vs. irrotational – whether small volumes have angular velocity • Viscous vs. inviscid – whether shear forces are present • Newtonian vs. non-Newtonian – model for viscous force • We will derive a model for incompressible, Newtonian, irrotational, viscous fluids. 4 Fluid dynamics • In the beginning, there was Newton… F = ma • So what forces are there on a fluid? 5 Forces on a Fluid • Imagine a small volume of fluid… (so we get forces per unit volume) • external or “body” forces (e.g., gravity) • relative pressure • “viscous friction” from other bits of fluid sliding by • inertia (not really a force, but needs some special treatment) 6 Getting rid of volume… • We want Newton’s 2nd in terms of forces per unit volume, so… F/V = m/V a • but, m/V is just the density ρ, so… f/ρ = a We’ll talk about forces per unit volume hereafter. 7 Body forces… • Gravity… • Rigid objects… • Other forces external to the fluid… • Denote the conglomeration of these forces by g, a force per unit mass. f external g 8 Pressure • Pressure (denoted p, a force per unit volume) in one tiny bit of fluid is relative to the pressure in neighboring tiny bits. f pressure p 9 Viscosity • “Friction” from other bits of fluid sliding by. From Chorin & Marsden. B and B’ are two blobs of fluid 10 Viscosity • For instance, we want the difference in zvelocity as we look in the x direction. • This generalizes in all dimensions to the Laplacian. fviscosity u 2 Note that this is the Laplacian for a vector-valued field, not a scalar-valued field. 11 Acceleration • Our little bit of fluid is moving along at some velocity u. • Two components of acceleration: – temporal change in velocity – motion of the bit of fluid 12 Acceleration • Temporal change in velocity u t • Movement of the bit of fluid (inertia) u u u ux uy uz u u x y z Where the ui are the velocities in the x, y and z directions 13 Navier-Stokes equation #1 • Putting this all together: u 1 2 u u p u g t Inertia Acceleration Viscosity Pressure External forces ν is μ/ρ and is called the kinematic viscosity. • This is conservation of energy. 14 Navier-Stokes equation #2 • We’re talking about incompressible fluids.. • So, the velocity into our little bit of fluid must be the same as the velocity out… u 0 • This is conservation of mass. • That the divergence is 0 states incompressibility. 15 “No-slip” condition • At the rigid, stationary boundaries of a fluid, velocity is zero. (experimentally and mathematically) • At non-stationary boundaries, the fluid velocity must be the same as that of the boundary. 16 Questions? • Any questions about how we got to the Navier-Stokes equations? 17 Solving these… • So, we have some differential equations… • We have four equations and four unknowns • What’s the problem? – Second order – Non-linear u 1 2 u u P u f t 18 Foster/Metaxas 1996 • “Realistic Animation of Liquids” • A finite differencing approximation with correction. • Regular, rectilinear discretization 19 Foster/Metaxas 1996 • Finite differencing approximation (1 dimension shown) • The point is that is the energy-conservation equation with all the differentials replaced by finite differences. 20 Foster/Metaxas 1996 • Conservation of mass isn’t assured. • Correction: Relax pressure and velocity until all cells satisfy both Navier-Stokes equations (to within some tolerance). u 0 means unconserved mass 21 Foster/Metaxas 1996 • Each cell looks at its neighbors… • So, stuff shouldn’t move more than one cell in a time step. • Two possibilities: – The largest velocity anywhere in the system determines an adaptive time step – For some fixed time step, the simulation eventually blows up. This causes instability. 22 Stam 1999 • “Stable Fluids” • Important features: – Semi-Lagrangian advection. – Implicit solvers – Projection 23 Stam 1999 • Semi-Lagrangian advection (called the method of characteristics). • Resolves the non-linearity u u • To find the velocity as some point, trace the velocity field backwards in time from that point along the path p. 24 Stam 1999 • Method of Characteristics: • A characteristic is a curve through a vector field on which a constant field element propagates. u u u 0 • Given the equation: t • Turn the PDE into some ODEs by taking u=u(x(s),t(s)) and using the chain rule to find du/ds=0 • Integrate with your favorite scheme. 25 Stam 1999 • Implicit solver for: u 2 u t • In implicit form, this is: 2 I t ui1 ui • Write this down as a finite difference equation and solve with the POIS3D linear solver from FISHPACK. 26 Stam 1999 • Projection – to ensure that the mass conservation condition is met. • The Helmholtz-Hodge Decompostion (a result from vector algebra): any vector field1 can be uniquely decomposed as: w u q • w and u are vector fields, u is divergencefree, and q is a scalar field. • Solve for q and subtract if from the result. 1There are some “well-behaved” constraints on the field. 27 Stam 1999 • These methods are chained together to solve the Navier-Stokes equations. • Stability: stable for any time step – In the advection step, the largest velocity generated is bounded by the maximum velocity in the earlier field. 28 References • Chorin, Alexandre J. and Jerrold E. Marsden, A Mathematical Introduction to Fluid Mechanics. 3rd ed. Springer: 1993. • Acheson, D.J. Elementary Fluid Dynamics. Oxford University Press: 1990. • Foster, Nick, and Dimitri Metaxas. “Realistic Animation of Liquids.” Graphics Models and Image Processing. 58(5):471-483, 1996. • Stam, Joe, “Stable Fluids.” SIGGRAPH 1999. 29