Water Computational Fluid Dynamics Volumes Lagrangian vs Eulerian

  • Slides: 31
Download presentation
 • • • Water Computational Fluid Dynamics Volumes Lagrangian vs. Eulerian modelling Navier-Stokes

• • • Water Computational Fluid Dynamics Volumes Lagrangian vs. Eulerian modelling Navier-Stokes equations Solving Navier-Stokes • Papers only… Foster and Fedkiw, 2001 1 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Computational Fluid Dynamics • CFD • Describes the characteristics of fluids in a volume

Computational Fluid Dynamics • CFD • Describes the characteristics of fluids in a volume • Animation vs. CFD – – 2 CFD – Initial conditions, let it run Animation – Looks real and we have control CFD – correctness Animation – efficiency CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Describing volumes • We need to describe the volume and what’s in it •

Describing volumes • We need to describe the volume and what’s in it • Volumes are typically described using regular voxels (3 D cells) (128 x 128 is common) Foster and Metaxas, 2000 – Boolean for each voxel 3 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Describing what’s in the volume • How do we describe water? – Ideas? 4

Describing what’s in the volume • How do we describe water? – Ideas? 4 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Two approaches • Derives from Computational Fluid Dynamics – Lagrangian models • What happens

Two approaches • Derives from Computational Fluid Dynamics – Lagrangian models • What happens at points in space – Eulerian models • Where does stuff go 5 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Lagrangian Models • Break space into volumes – Describe what is in each volume

Lagrangian Models • Break space into volumes – Describe what is in each volume • Example: Incompressibility – What goes in must match what goes out 6 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Eulerian Models • We track motion of actual things over time – Particles are

Eulerian Models • We track motion of actual things over time – Particles are usually used to represent water • Example: Incompressibility – Particles must adhere to some packing rule 7 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Navier-Stokes equation • Describes the motion of incompressible fluids – Water, oil, mud, etc.

Navier-Stokes equation • Describes the motion of incompressible fluids – Water, oil, mud, etc. 8 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Divergence • u is the liquid velocity field • Operator is called the “divergence”

Divergence • u is the liquid velocity field • Operator is called the “divergence” operator. – Divergence of a vector field F, denoted div(F) or as above is a scalar field – When equal to zero (zero vector), we have a divergenceless field 9 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Gradient vs. Divergence • I hate operator overloading 10 CSE 872 Dr. Charles B.

Gradient vs. Divergence • I hate operator overloading 10 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Divergenceless field • Implies incompressiblity – Mass is conserved – What goes out a

Divergenceless field • Implies incompressiblity – Mass is conserved – What goes out a point equals what goes in • Note: This is “inside” the water, not what happens when air mixes in 11 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

More equation parts Gravity and force viscous drag viscosity 12 convection velocity pressure density

More equation parts Gravity and force viscous drag viscosity 12 convection velocity pressure density CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Problems with Navier-Stokes • Acceleration is associated with moving elements, so Eulerian models make

Problems with Navier-Stokes • Acceleration is associated with moving elements, so Eulerian models make sense • Pressure and boundary conditions are at locations, so Lagrangian models make sense • Some methods use semi-Lagrangian models 13 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Foster and Fedkiw method • 1. Model environment as a voxel grid • 2.

Foster and Fedkiw method • 1. Model environment as a voxel grid • 2. Model liquid volume using particles and implicit surface • 3. Update velocity field by solving Navier-Stokes using finite differences and a semi-Lagrangian method • 4. Apply velocity constraints from moving objects • 5. Enforce incompressibility • 6. Update the liquid volume using new velocity field 14 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

The volume representation • Each cell has – Flag for filled or available for

The volume representation • Each cell has – Flag for filled or available for water – Pressure variable at center (optional) – Velocity vectors on 3 sides • Shared with adjacent cell 15 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Particles • Water is represented by particles – Introduced from source or initially placed

Particles • Water is represented by particles – Introduced from source or initially placed – Motion for particle is determined by tri-linear interpolation 16 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Isocontour • Imagine each particle with a sphere around it Isocontour 17 CSE 872

Isocontour • Imagine each particle with a sphere around it Isocontour 17 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Practical system issues • The isocontour is all we need for creating the image

Practical system issues • The isocontour is all we need for creating the image • High particle densities are needed to make good isocontours, but create lots of complexity • Create initial isocontour at high density, then use lower density motion fields to deform the isocontour • Other option: dynamically create/destroy particles 18 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Solving Navier-Stokes • Step 1: Choose a time step • Good rule of thumb:

Solving Navier-Stokes • Step 1: Choose a time step • Good rule of thumb: Nothing can jump over any cells – ? ? ? 19 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Solving • Step 2: Solve for the velocity • This is so much fun

Solving • Step 2: Solve for the velocity • This is so much fun • Let w 0(x) be a solution at location x at time t 1 – We’ll move to a solution at time t 2 using four steps 20 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Getting to w 1: Add force • w 1(x) = w 0(x) + Dt

Getting to w 1: Add force • w 1(x) = w 0(x) + Dt f 21 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Getting to w 2: Add convection • At each time step, all particles are

Getting to w 2: Add convection • At each time step, all particles are moved by the velocity of the fluid • The particle at location x was at location p(x, t-Dt) before • Let w 2(x)=w 1(p(x, t-Dt)) • All that is required is a way to track particles and some linear interpolation. 22 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Getting to w 3: Viscosity • Can be shown that: 23 CSE 872 Dr.

Getting to w 3: Viscosity • Can be shown that: 23 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Finite differences • How do we get from • Finite differences: 24 or to

Finite differences • How do we get from • Finite differences: 24 or to code on arrays? CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Solving for viscosity This is a standard problem formulation called the Poisson Problem and

Solving for viscosity This is a standard problem formulation called the Poisson Problem and can be solved using numerous solving packages like FISHPAK. 25 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

From FISHPAK C C C 26 Subroutine POIS 3 D solves the linear system

From FISHPAK C C C 26 Subroutine POIS 3 D solves the linear system of equations C 1*(X(I-1, J, K)-2. *X(I, J, K)+X(I+1, J, K)) + C 2*(X(I, J-1, K)-2. *X(I, J, K)+X(I, J+1, K)) + A(K)*X(I, J, K-1)+B(K)*X(I, J, K)+C(K)*X(I, J, K+1) = F(I, J, K) CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Getting to w 4: Incompressiblity • Our solution will have a divergence part and

Getting to w 4: Incompressiblity • Our solution will have a divergence part and a divergence-free part. We need to solve for the divergence part and subtract it out. 27 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Estimating the divergence of the velocity field 28 CSE 872 Dr. Charles B. Owen

Estimating the divergence of the velocity field 28 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Cont… Again, we have a Poisson Problem. 29 CSE 872 Dr. Charles B. Owen

Cont… Again, we have a Poisson Problem. 29 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

What about pressure? • Issues of incompressibility • Stam claims that pressure drops out

What about pressure? • Issues of incompressibility • Stam claims that pressure drops out in his solution. This would be a consequence of the way he deals with incompressibility. 30 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics

Boundary conditions • What about where we run out of space? – Set velocity

Boundary conditions • What about where we run out of space? – Set velocity to zero? (paper says this) – Or what other option? 31 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics