Hank Childs, University of Oregon Lecture #6 CIS 410/510: Advection (Part 1)

Slides:



Advertisements
Similar presentations
Stable Fluids A paper by Jos Stam.
Advertisements

Formal Computational Skills
Reasoning About Code; Hoare Logic, continued
Manipulator Dynamics Amirkabir University of Technology Computer Engineering & Information Technology Department.
Hank Childs, University of Oregon November 6 th, 2013 Spatial-Based and Variable-Based Selections.
Hank Childs, University of Oregon November 15 th, 2013 Volume Rendering, Part 2.
Ordinary Differential Equations
1cs542g-term Notes  Notes for last part of Oct 11 and all of Oct 12 lecture online now  Another extra class this Friday 1-2pm.
Total Recall Math, Part 2 Ordinary diff. equations First order ODE, one boundary/initial condition: Second order ODE.
PART 7 Ordinary Differential Equations ODEs
Surface to Surface Intersection N. M. Patrikalakis, T. Maekawa, K. H. Ko, H. Mukundan May 25, 2004.
Ordinary Differential Equations. Outline Announcements: –Homework II: Solutions on web –Homework III: due Wed. by 5, by Homework II Differential.
CSE351/ IT351 Modeling and Simulation
11 September 2007 KKKQ 3013 PENGIRAAN BERANGKA Week 10 – Ordinary Differential Equations 11 September am – 9.00 am.
Manipulator Dynamics Amirkabir University of Technology Computer Engineering & Information Technology Department.
Numerical Solutions of Ordinary Differential Equations
Lecture 10: Robust fitting CS4670: Computer Vision Noah Snavely.
Chapter 3 Root Finding.
Computer graphics & visualization Rigid Body Simulation.
Ordinary Differential Equations (ODEs) 1Daniel Baur / Numerical Methods for Chemical Engineers / Explicit ODE Solvers Daniel Baur ETH Zurich, Institut.
Numerical Solution of Ordinary Differential Equation
Fin500J Topic 7Fall 2010 Olin Business School 1 Fin500J Mathematical Foundations in Finance Topic 7: Numerical Methods for Solving Ordinary Differential.
1 Chapter 6 Numerical Methods for Ordinary Differential Equations.
PART 7 Ordinary Differential Equations ODEs
Ordinary Differential Equations (ODEs) 1Daniel Baur / Numerical Methods for Chemical Engineers / Explicit ODE Solvers Daniel Baur ETH Zurich, Institut.
Numerical Solutions to ODEs Nancy Griffeth January 14, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis.
MA/CS 375 Fall MA/CS 375 Fall 2002 Lecture 13.
Ch 8.1 Numerical Methods: The Euler or Tangent Line Method
Ch 8.3: The Runge-Kutta Method
Time integration methods for the Heat Equation Solution u for t= Tobias Köppl TUM.
Erin Catto Blizzard Entertainment Numerical Integration.
EE3561_Unit 8Al-Dhaifallah14351 EE 3561 : Computational Methods Unit 8 Solution of Ordinary Differential Equations Lesson 3: Midpoint and Heun’s Predictor.
CDS 301 Fall, 2009 Vector Visualization Chap. 6 October 7, 2009 Jie Zhang Copyright ©
Torricelli’s Law and Draining Pipes
1 RECENT DEVELOPMENTS IN MULTILAYER PERCEPTRON NEURAL NETWORKS Walter H. Delashmit Lockheed Martin Missiles and Fire Control Dallas, TX 75265
Numerical Integration and Rigid Body Dynamics for Potential Field Planners David Johnson.
Hank Childs, University of Oregon October 3, 2014 CIS 441/541: Intro to Computer Graphics Lecture 2: The Scanline Algorithm.
Fluid Mechanics and Fluid Dynamics Fluid mechanics is the branch of physics that studies fluids (liquids, gases, and plasmas) and the forces on them. Fluid.
2D Flow Visualization streamline, pathline, hedges, spotnoise 郭翰琦 陈珩.
Lecture Fall 2001 Physically Based Animation Ordinary Differential Equations Particle Dynamics Rigid-Body Dynamics Collisions.
Hank Childs, University of Oregon Lecture #4 Fields, Meshes, and Interpolation (Part 3)
Hank Childs, University of Oregon Lecture #3 Fields, Meshes, and Interpolation (Part 2)
MA/CS 375 Fall MA/CS 375 Fall 2002 Lecture 12.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Physics for Games Spring 2012.
Vector Field Visualization
Hank Childs, University of Oregon Lecture #10 CIS 410/510: Isosurfacing.
Ordinary Differential Equations (ODEs) 1Michael Sokolov / Numerical Methods for Chemical Engineers / Explicit ODE Solvers Michael Sokolov ETH Zurich, Institut.
Hank Childs, University of Oregon Lecture #9 CIS 410/510: Advection (Part 4!)
Hank Childs, University of Oregon Isosurfacing (Part 3)
Komputasi Numerik: Integrasi dan Differensiasi Numerik Agus Naba Physics Dept., FMIPA-UB.
Data Visualization Fall 2015.
Hank Childs, University of Oregon Unstructured Grids.
Chapter 10 ordinary differential equations (ODEs) Chapter 11 systems of ODEs (6 th edition)
Hank Childs, University of Oregon Volume Rendering, pt 1.
Announcements Read Chapters 11 and 12 (sections 12.1 to 12.3)
Intro to Simulink April 15, Copyright , Andy Packard. This work is licensed under the Creative Commons.
Please remember: When you me, do it to Please type “numerical-15” at the beginning of the subject line Do not reply to my gmail,
ECE 576 – Power System Dynamics and Stability Prof. Tom Overbye Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.
Ordinary Differential Equations
Outline Announcements: –HW I key online this afternoon –HW II due Friday –Sign up to discuss projects Debugging Testging for correctness.
Lecture 39 Numerical Analysis. Chapter 7 Ordinary Differential Equations.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 6 - Chapters 22 and 23.
AME 513 Principles of Combustion Lecture 5 Chemical kinetics II – Multistep mechanisms.
Robert S. Laramee 1 Visualization, Lecture Flow visualization, Part 2 (of 3)
CIS 410/510: Isosurfacing (pt 2)
Hank Childs, University of Oregon
Hank Childs, University of Oregon
Vector Field Visualization
Hank Childs, University of Oregon
Hank Childs, University of Oregon
Presentation transcript:

Hank Childs, University of Oregon Lecture #6 CIS 410/510: Advection (Part 1)

Outline Announcements Project 3 Advection

Outline Announcements Project 3 Advection

Announcements Weekly OH: Weds 1-2, Thurs: 11:30-12:30 BUT: Thurs 11:30-12:30 canceled this week – NSF Panel Likely replaced by Sat OH

Outline Announcements Project 3 Advection

Project 3 Assigned Sunday, prompt online Due October 17 th, midnight (  October 18 th, 6am) Worth 5% of your grade Provide: – Code skeleton online – Correct answers provided You upload to Canvas: – source code – three images from your program

Project 3 in a nutshell I give you a 2D data set. You will produce 3 images that are 500x500 pixels. The 2D data set will be mapped on to the pixels. Pixel (0,0): X=-9, Y=-9 Pixel (499, 0): X=+9, Y=-9, pixel (0,499): X=-9, Y=+9 Pixel (499,499): X=+9, Y=+9

Project 3 in a nutshell For each of the 250,000 pixels (500x500), you will apply 3 color maps to a scalar field

Outline Announcements Project 3 Advection

Particle advection is the foundation to many visualization algorithms Advection will require us to evaluate velocity at arbitrary locations.

LERPing vectors LERP = Linear Interpolate Goal: interpolate vector between A and B. Consider vector X, where X = B-A A + t*(B-A) = A+t*X Takeaway: – you can LERP the components individually – the above provides motivation for why this works A B X = B-A A X t A+t*X

Quiz Time: LERPing vectors F(10,12) = (-1, 2) F(11,12) = (1,5) F(11,13) = (6,1) F(10,13) = (1,1) What is value of F(10.3, 12)? Answer: (-0.4, 2.9)

Particle advection is the foundation to many visualization algorithms Courtesy C. Garth, Kaiserslautern

Overview of advection process Place a massless particle at a seed location Displace the particle according to the vector field Result is an “integral curve” corresponding to the trajectory the particle travels Math gets tricky What would be the difference between a massless and “mass-ful” particle?

Formal definition for particle advection Output is an integral curve, S, which follows trajectory of the advection S(t) = position of curve at time t – S(t 0 ) = p 0 t 0 : initial time p 0 : initial position – S’(t) = v(t, S(t)) v(t, p): velocity at time t and position p S’(t): derivative of the integral curve at time t This is an ordinary differential equation (ODE).

The integral curve for particle advection is calculated iteratively S(t 0 ) = p 0 while (ShouldContinue()) { S(t i ) = AdvanceStep(S(t (i-1) ) } Many possible criteria for ShouldContinue. For now, assume fixed number of steps. Many possible criteria for ShouldContinue. For now, assume fixed number of steps.

Integral curve calculation with a fixed number of steps S 0 = P 0 for (int i = 1 ; i < numSteps ; i++) { S i = AdvanceStep(S (i-1) ) } How to do an advance?

AdvanceStep goal: to calculate S i from S (i-1) S 1 = AdvanceStep(S 0 )S0 S1 S 2 = AdvanceStep(S 1 ) S2 S 3 = AdvanceStep(S 2 ) S3 S 4 = AdvanceStep(S 3 ) S4 S 5 = AdvanceStep(S 4 ) S5 This picture is misleading: steps are typically much smaller. This picture is misleading: steps are typically much smaller.

AdvanceStep Overview Think of AdvanceStep as a function: – Input arguments: S (i-1) : Position, time – Output arguments: S i : New position, new time (later than input time) – Optional input arguments: More parameters to control the stepping process.

AdvanceStep Overview Different numerical methods for implementing AdvanceStep: – Simplest version: Euler step – Most common: Runge-Kutta-4 (RK4) – Several others as well

Euler Method Most basic method for solving an ODE Idea: – First, choose step size: h. – Second, AdvanceStep(p i, t i ) returns: New position: p i+1 = p i +h*v(t i, p i ) New time: t i+1 = t i +h

Quiz Time: Euler Method Euler Method: – New position: p i+1 = p i +h*v(t i, p i ) – New time: t i+1 = t i +h Let h=0.01s Let p 0 = (1,2,1) Let t 0 = 0s Let v(p 0, t 0 ) = (-1, -2, -1) What is (p 1, t 1 ) if you are using an Euler method? Answer: ((0.99, 1.98, 0.99), 0.01)

Quiz Time #2: Euler Method Euler Method: – New position: p i+1 = p i +h*v(t i, p i ) – New time: t i+1 = t i +h Let h=0.01s Let p 1 = (0.99,1.98,0.99) Let t 1 = 0.01s Let v(p 1, t 1 ) = (1, 2, 1) What is (p 2, t 2 ) if you are using an Euler method? Answer: ((1, 2, 1), 0.02)

Quiz Time #3: Euler Method Euler Method: – New position: p i+1 = p i +h*v(t i, p i ) – New time: t i+1 = t i +h Let h=0.01s Let p 2 = (1,2,1) Let t 2 = 0.02s Let v(p 2, t 2 ) = (1, 0, 0) What is (p 3, t 3 ) if you are using an Euler method? Answer: ((1.01, 2, 1), 0.03)

Euler Method: Pros and Cons Pros: – Simple to implement – Computationally very efficient (quiz) Cons: – Prone to inaccuracy Above statements are an oversimplification: – Can be very accurate with small steps size, but then also very inefficient. – Can be very fast, but then also inaccurate.

Quiz Time You want to perform a particle advection. What inputs do you need? – Velocity field – Step size – Termination criteria / # of steps – Initial seed position / time

Quiz Time Write down pseudo-code to do advection with an Euler step: – Initial seed location: (0,0,0) – Initial seed time: 0s – Step size = 0.01s – Velocity field: v – Termination criteria: advance 0.1s (take 10 steps) – Function to evaluate velocity: EvaluateVelocity(position, time)

Quiz Time (answer) S[0] = (0,0,0); time = 0; for (int i = 0 ; i < 10 ; i++) { S[i+1] = S[i]+h*EvaluateVelocity(S[i], time); time += h; }

Runge-Kutta Method (RK4) Most common method for solving an ODE Definition: – First, choose step size, h. – Second, AdvanceStep(p i, t i ) returns: New position: p i+1 = p i +(1/6)*h*(k 1 +2k 2 +2k 3 +k 4 ) – k 1 = v(t i, p i ) – k 2 = v(t i + h/2, p i + h/2*k 1 ) – k 3 = v(t i + h/2, p i + h/2*k 2 ) – k 4 = v(t i + h, p i + h*k 3 ) New time: t i+1 = t i +h

Physical interpretation of RK4 New position: p i+1 = p i +(1/6)*h*(k 1 +2k 2 +2k 3 +k 4 ) – k 1 = v(t i, p i ) – k 2 = v(t i + h/2, p i + h/2*k 1 ) – k 3 = v(t i + h/2, p i + h/2*k 2 ) – k 4 = v(t i + h, p i + h*k 3 ) pipi v(t i, p i ) = k 1 p i + h/2*k 1 v(t i +h/2, p i +h/2*k 1 ) = k 2 p i + h/2*k 2 v(t i +h/2, p i +h/2*k 2 ) = k 3 p i + h*k 3 v(t i +h, p i +h*k 3 ) = k 4 Evaluate 4 velocities, use combination to calculate p i+1

Quiz time: Runge-Kutta 4 Just kidding

Runge-Kutta vs Euler Euler Method: – “1 st order numerical method for solving ordinary differential equations (ODEs)”  error per step is O(h 2 ), total error is O(h) Runge-Kutta: – “4 th order numerical method for solving ODEs”  error per step is O(h 5 ), total error is O(h 4 ) Intuition: all of RK4’s “look-aheads” prevents you from stepping too far into the wrong place. h is small, so h x is smaller still

Quiz Time: RK4 vs Euler Let h=0.01s – How many velocity field evaluations for RK4 to advance 1s? – How many velocity field evaluations for Euler to advance 1s? 400 for RK4, 100 for Euler

Quiz Time: RK4 vs Euler Let h=0.01 for an RK4 What h for Euler to achieve similar accuracy? Error for RK4 is: O(1e-2^4) = O(1e-8) Error for Euler is: O(h^2) --- > h=1e-4 What is the ratio of velocity evaluations for Euler to achieve same accuracy? 25X more for Euler

Other ODE solvers Adams/Bashforth, Dormand/Prince are also used Idea: adaptive step size. – If the field is homogeneous, then take a bigger step size (bigger h) – If the field is heterogeneous, then take a smaller step size Quiz: why would you want to do this? Answer: great accuracy at reduced computational cost

Termination criteria Time

Termination criteria Time Distance

Termination criteria Time Distance Number of steps – Same as time? Other advanced criteria, based on particle advection purpose

Other reasons for advection termination Exit the volume

Advect into a sink Other reasons for advection termination

Steady versus Unsteady State Unsteady state: the velocity field evolves over time Steady state: the velocity field has reached steady state and remains unchanged as time evolves

Most common particle advection technique: streamlines and pathlines Idea: plot the entire trajectory of the particle all at one time. Streamlines in the “fish tank”

Streamline vs Pathlines Streamlines: plot trajectory of a particle from a steady state field Pathlines: plot trajectory of a particle from an unsteady state field Quiz: most common configuration? – Neither!! – Pretend an unsteady state field is actually steady state and plot streamlines from one moment in time. Quiz: why would anyone want to do this? – (answer: performance)

Pathlines in the real world

Lots more to talk about How do we pragmatically deal with unsteady state flow (velocities that change over time)? More operations based on particle advection Stability of results