FLUID SIMULATION. Kristofer Schlachter

Similar documents
CS-184: Computer Graphics Lecture #21: Fluid Simulation II

CS 231. Fluid simulation

CUDA. Fluid simulation Lattice Boltzmann Models Cellular Automata

CGT 581 G Fluids. Overview. Some terms. Some terms

Navier-Stokes & Flow Simulation

Overview of Traditional Surface Tracking Methods

Navier-Stokes & Flow Simulation

Realistic Animation of Fluids

Fluid Simulation. [Thürey 10] [Pfaff 10] [Chentanez 11]

Adarsh Krishnamurthy (cs184-bb) Bela Stepanova (cs184-bs)

Realistic Animation of Fluids

Navier-Stokes & Flow Simulation

PHYSICALLY BASED ANIMATION

Realtime Water Simulation on GPU. Nuttapong Chentanez NVIDIA Research

2.7 Cloth Animation. Jacobs University Visualization and Computer Graphics Lab : Advanced Graphics - Chapter 2 123

CMPT 898 Final Report. Adam L. Preuss. Numerical Simulation Laboratory. Department of Computer Science. University of Saskatchewan

Divergence-Free Smoothed Particle Hydrodynamics

Animation of Fluids. Animating Fluid is Hard

The 3D DSC in Fluid Simulation

Water. Notes. Free surface. Boundary conditions. This week: extend our 3D flow solver to full 3D water We need to add two things:

Finite Volume Discretization on Irregular Voronoi Grids

A High Quality, Eulerian 3D Fluid Solver in C++ A Senior Project. presented to. the Faculty of the Computer Science Department of

CS GPU and GPGPU Programming Lecture 2: Introduction; GPU Architecture 1. Markus Hadwiger, KAUST

Computer animation for fluid simulation of a high viscous fluid melting

Realistic Smoke Simulation Using A Frustum Aligned Grid

cuibm A GPU Accelerated Immersed Boundary Method

About Phoenix FD PLUGIN FOR 3DS MAX AND MAYA. SIMULATING AND RENDERING BOTH LIQUIDS AND FIRE/SMOKE. USED IN MOVIES, GAMES AND COMMERCIALS.

Surface Tension Approximation in Semi-Lagrangian Level Set Based Fluid Simulations for Computer Graphics

Simple and Fast Fluids

Smoke Simulation using Smoothed Particle Hydrodynamics (SPH) Shruti Jain MSc Computer Animation and Visual Eects Bournemouth University

Two-Phase flows on massively parallel multi-gpu clusters

The Immersed Interface Method

Available online at ScienceDirect. Parallel Computational Fluid Dynamics Conference (ParCFD2013)

Level set methods Formulation of Interface Propagation Boundary Value PDE Initial Value PDE Motion in an externally generated velocity field

An adaptive discretization of incompressible flow using a multitude of moving Cartesian grids

Real-Time Volumetric Smoke using D3D10. Sarah Tariq and Ignacio Llamas NVIDIA Developer Technology

AN ADAPTIVE SAMPLING APPROACH TO INCOMPRESSIBLE PARTICLE-BASED FLUID. A Dissertation WOO-SUCK HONG

Particle-based Fluid Simulation

HYPERDRIVE IMPLEMENTATION AND ANALYSIS OF A PARALLEL, CONJUGATE GRADIENT LINEAR SOLVER PROF. BRYANT PROF. KAYVON 15618: PARALLEL COMPUTER ARCHITECTURE

CUDA/OpenGL Fluid Simulation. Nolan Goodnight

6.1 Rendering Wet Sand

Fluids in Games. Jim Van Verth Insomniac Games

Fluid Simulation Quality with Violated CFL Condition

Chapter 6. Semi-Lagrangian Methods

Multigrid Solvers in CFD. David Emerson. Scientific Computing Department STFC Daresbury Laboratory Daresbury, Warrington, WA4 4AD, UK

IMPROVED WALL BOUNDARY CONDITIONS WITH IMPLICITLY DEFINED WALLS FOR PARTICLE BASED FLUID SIMULATION

Volcanic Smoke Animation using CML

Efficient Tridiagonal Solvers for ADI methods and Fluid Simulation

Moving Interface Problems: Methods & Applications Tutorial Lecture II

A higher-order finite volume method with collocated grid arrangement for incompressible flows

Solving Partial Differential Equations on Overlapping Grids

3D ADI Method for Fluid Simulation on Multiple GPUs. Nikolai Sakharnykh, NVIDIA Nikolay Markovskiy, NVIDIA

Fluid Simulation. Dhruv Kore, Giancarlo Gonzalez, and Jenny Sum CS 488: Introduction to Computer Graphics Professor Angus Forbes

A New Incompressibility Discretization for a Hybrid Particle MAC Grid Representation with Surface Tension

Drop Impact Simulation with a Velocity-Dependent Contact Angle

CONFORMAL MAPPING POTENTIAL FLOW AROUND A WINGSECTION USED AS A TEST CASE FOR THE INVISCID PART OF RANS SOLVERS

Particle-Based Fluid Simulation. CSE169: Computer Animation Steve Rotenberg UCSD, Spring 2016

ENERGY-224 Reservoir Simulation Project Report. Ala Alzayer

A multi-gpu accelerated solver for the three-dimensional two-phase incompressible Navier-Stokes equations

Overview. Applications of DEC: Fluid Mechanics and Meshing. Fluid Models (I) Part I. Computational Fluids with DEC. Fluid Models (II) Fluid Models (I)

Driven Cavity Example

Computational Fluid Dynamics - Incompressible Flows

The Development of a Navier-Stokes Flow Solver with Preconditioning Method on Unstructured Grids

CS205b/CME306. Lecture 9

Bubble Dynamics using Free Surfaces in a VOF framework

Shape of Things to Come: Next-Gen Physics Deep Dive

CNM 190, pt 2 Advanced Digital Animation Lec 03 : Art Direction on Madagascar / Effects 1

2.29 Numerical Marine Hydrodynamics Spring 2007

An adaptive discretization of incompressible flow using a multitude of moving Cartesian grids

Eulerian Smoke Simulation. Brett Lambright (i ) MSc Computer Animation and Visual Effects Bournemouth University - NCCA

Eulerian Fluid Simulator

Animating smoke with dynamic balance

Lagrangian methods and Smoothed Particle Hydrodynamics (SPH) Computation in Astrophysics Seminar (Spring 2006) L. J. Dursi

Comparison between incompressible SPH solvers

A Performance Optimization Study for the DreamWorks Animation Fluid Solver

Numerical Methods for PDEs. SSC Workgroup Meetings Juan J. Alonso October 8, SSC Working Group Meetings, JJA 1

GPU-based Distributed Behavior Models with CUDA

Analysis of the Adjoint Euler Equations as used for Gradient-based Aerodynamic Shape Optimization

NVIDIA. Interacting with Particle Simulation in Maya using CUDA & Maximus. Wil Braithwaite NVIDIA Applied Engineering Digital Film

FLUENT Secondary flow in a teacup Author: John M. Cimbala, Penn State University Latest revision: 26 January 2016

Scalar Field Visualization. Some slices used by Prof. Mike Bailey

Interaction of Fluid Simulation Based on PhysX Physics Engine. Huibai Wang, Jianfei Wan, Fengquan Zhang

Lattice Boltzmann with CUDA

Computational Fluid Dynamics Simulations using Many Graphics Processors

Animation and Ray Tracing

Theodore Kim Michael Henson Ming C.Lim. Jae ho Lim. Korea University Computer Graphics Lab.

FEMLAB Exercise 1 for ChE366

PARALLEL SIMULATION OF A FLUID FLOW BY MEANS OF THE SPH METHOD: OPENMP VS. MPI COMPARISON. Pawe l Wróblewski, Krzysztof Boryczko

PARALUTION - a Library for Iterative Sparse Methods on CPU and GPU

IMMERSED BOUNDARY METHOD FOR SHARED-MEMORY ARCHITECTURES. 1. Introduction

Recent applications of overset mesh technology in SC/Tetra

Hybrid Particle-Grid Water Simulation using Multigrid Pressure Solver

Adaptive Particles for Incompressible Fluid Simulation (Technical Report tamu-cs-tr )

Imagery for 3D geometry design: application to fluid flows.

GPU Methods for Real-Time Haptic Interaction with 3D Fluids

LATTICE-BOLTZMANN METHOD FOR THE SIMULATION OF LAMINAR MIXERS

An Efficient Adaptive Vortex Particle Method for Real-Time Smoke Simulation

Continuum-Microscopic Models

Lecture 1: Finite Volume WENO Schemes Chi-Wang Shu

Fluid Simulation and Reaction-Diffusion Textures on Surfaces Maria Andrade Luiz Velho (supervisor) Technical Report TR Relatório Técnico

Transcription:

FLUID SIMULATION Kristofer Schlachter

The Equations Incompressible Navier-Stokes: @u @t = (r u)u 1 rp + vr2 u + F Incompressibility condition r u =0

Breakdown @u @t The derivative of velocity with respect to time. Calculated at each grid point each time step. (r u)u The convection term. This is the self advection term. In the code we will use the backward particle trace for this term. r The pressure term. is the density of the fluid vr 2 u or The viscosity term. We are actually going to ignore this term. When you do that you are actually vr ru r r using the Euler Equations. External force. Any external forces including F External force. Any external forces including gravity.

Breakdown 1 rp r cle trace for this term. The pressure term. is the density of the fluid a and p is the pressure. p is whatever it takes to make the velocity field divergence free. The simulator will solve for a pressure that makes our fluid incompressible at each time step. a density of water 1000 kg m 2

3 Incompressible Euler Equations If you drop the viscosity term from the incompressible Navier Stokes equations we get: @u @t +(r u)u + 1 rp = F (4) r u =0 (5) Such an ideal fluid with no viscosity is called inviscid. These are the equations we are going to use.

How do we discretize the equations?

A Simple Grid We could put all our fluid variables at the nodes of a regular grid But this causes some major problems In 1D: incompressibility means Approximate at a grid point: u x = 0 u i+1 u i 1 2Δx Note the velocity at the grid point isn t involved! = 0 [Bridson 07]

A Simple Grid Disaster The only solutions to u x = 0 are u=constant But our numerical version has other solutions: u x [Bridson 07]

Staggered Grids Problem is solved if we don t skip over grid points To make it unbiased, we stagger the grid: put velocities halfway between grid points In 1D, we estimate divergence at a grid point as: Problem solved! u x (x i ) u i+ 1 2 u i 1 2 Δx [Bridson 07]

The MAC Grid From the Marker-and-Cell (MAC) method [Harlow&Welch 65] A particular staggering of variables in 2D/3D that works well for incompressible fluids: Grid cell (i,j,k) has pressure p i,j,k at its center x-part of velocity u i+1/2,jk in middle of x-face between grid cells (i,j,k) and (i+1,j,k) y-part of velocity v i,j+1/2,k in middle of y-face z-part of velocity w i,j,k+1/2 in middle of z-face [Bridson 07]

MAC Grid in 2D p i, j +1 v i, j + 1 2 p i 1, j p i, j p i+1, j u i 1 2, j u i+ 1 2, j v i, j 1 2 p i, j 1 [Bridson 07]

Math on a MAC Grid The partial derivative (@). tral difference: @f(x, y, z) = f(x, y +1,z) @y f(x, y, z) ent operator r The gradient operator (r) 0 1 f(x +1,y,z) f(x, y, z), B C rf(x, y, z) = @ f(x, y +1,z) f(x, y, z), A f(x, y, z +1) f(x, y, z)

B @ Math on a MAC Grid The divergence of a vector field (r ) r u(x, y, z) =(u x (x +1,y,z) The Laplacian operator (r 2 ) or (r r). gradient operators. u x (x, y, z))+ (u y (x, y +1,z) u y (x, y, z))+ (u z (x, y, z +1) u z (x, y, z)) r 2 f(x, y, z) =f(x +1,y,z)+f(x f(x, y +1,z)+f(x, y 1,y,z)+ 1,z)+ f(x, y, z +1)+f(x, y, z 1) 6f(x, y, z) *There might be a one over h squared term missing

Simulation Set u A = advect(u n, t, u n ) Add u B = u A + tf Set u n+1 = project( t, u B ) *I am ignoring choosing a time step in this presentation

Advection Figure 3: Basic idea behind the advection step. Instead of moving the cell centers forward in time (b) through the velocity field shown in (a), we look for the particles which end up exactly at the cell centers by tracing backwards in time from the cell centers (c). [Stam 2003]

onfused by the e[david Cline ] Advection x mid = x G 1 2 tu (x G) x p = x G tu (x mid ) q n+1 G = interpolate (q n,x p ) he new value of the quantity(velocit

Projection The project( t, u) routine does the following: Calculate the negative divergence b (the right-hand side) Set the entries of A If using CG - Construct the MIC(0) preconditioner. Solve Ap = b with a linear solver. If using CG then solve with MICCG(0), i.e., the PCG algorithm with MIC(0) as preconditioner. Compute the new velocities n n+1 according to the pressuregradient update to u.

Projection Setting up the divergence vector b (the right hand side) r u(x, y, z) =(u x (x +1,y,z) u x (x, y, z))+ (u y (x, y +1,z) u y (x, y, z))+ (u z (x, y, z +1) u z (x, y, z))

Projection 7 Setting up the matrix 2 1 1,2... 5 3 1,n 2. 2,1.. 2 6 6 4. 7 4... 5 n 1,n 1 n,1 n,n 1 n 6 4 7 5 p 1 p 2.. p n 3 6 4 7 5 = 2 6 4 D 1 D 2. D n 3 7 5 Where Di corresponds to the divergences through cell i. Ωi is the number of nonsolid neighbors of cell i, and βi,j takes values based upon the equation: i,j = ( 1 if cell i is a neighbor of cell j 0 otherwise This matrix is well known. It is called a 7 Point Laplacian Matrix

Projection Calculate the pressure gradient and subtract it from the velocity field to ensure it is divergence free: u n+1 i+ 1 2,j,k = un i+ 1 2,j,k t 1 p i+1,j,k x p i,j,k v n+1 i,j+ 1 2,k = vn i,j+ 1 2,k t 1 p i,j+1,k x p i,j,k w n+1 i,j,k+ 1 2 = w n i,j,k+ 1 2 t 1 p i,j,k+ x p i,j,k

Demo

Implementation Mapping to Mechanisms: Stencils Common example ( 5-point stencil ): u n+1 i,j = 1 h 2 ( 4un i,j+u n i 1,j+u n i+1,j + u n i,j 1 + u n i,j+1) Sequential OpenMP? MPI? GPU 2D? GPU 3D? Remember this slide from the last lecture? Visualization Parallel Patterns

Implementation Thoughts on optimization for parallel execution The most time consuming part of the sim is the pressure solve so the optimization should start with solving it quickly. Optimizations for serial & CPU: Blocking: Cache coherent. Can send blocks to different cores Optimizations for GPU: Do blocking again using local memory to store each block. For 3D use slicing, 3 Slices at a time putting middle slice (block) in local memory.